// SPDX-License-Identifier: GPL-3.0-only // SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts® export module Nostro.Ui:Theme; import std; import :Geometry; // The colours and sizes every widget draws with. The colours follow the system: light or dark, and its accent // colour. The sizes are the design's (dp), turned into pixels where they are used. export namespace Nostro::Ui { struct Theme { Color background{0.96f, 0.96f, 0.97f}; // behind everything Color surface{1.0f, 1.0f, 1.0f}; // bars, cards, sheets, fields Color surfaceAlt{0.93f, 0.93f, 0.94f}; // what stands out from a surface: a chip, a selected tab Color text{0.11f, 0.11f, 0.12f}; Color muted{0.43f, 0.43f, 0.45f}; // secondary text Color accent{0.18f, 0.44f, 0.93f}; Color onAccent{1.0f, 1.0f, 1.0f}; // text on the accent colour Color divider{0.88f, 0.88f, 0.89f}; Color positive{0.10f, 0.53f, 0.25f}; // money coming in Color warning{1.0f, 0.95f, 0.80f}; // a notice's ground Color onWarning{0.40f, 0.30f, 0.01f}; Color danger{0.80f, 0.16f, 0.16f}; // an error, a step that cannot be undone Color onDanger{1.0f, 1.0f, 1.0f}; Color scrim{0.0f, 0.0f, 0.0f, 0.35f}; // over what a sheet covers bool dark = false; static Theme Light(); static Theme Dark(); // The system's accent colour, with text on it dark or light as its brightness asks. void Accent(Color color); // A control's colour while the pointer is over it, and while it is pressed: tinted towards the text colour, so // the change shows on a light theme and on a dark one. Color Hovered(Color color) const; Color Pressed(Color color) const; // The one taken of a few choices that stand on the quiet ground: lighter than that ground, as what is raised // from it would be, on a light theme and on a dark one. Color Taken() const; }; // Text sizes, in dp. namespace TextSize { inline constexpr float display = 32; // a balance inline constexpr float title = 22; // a screen's title inline constexpr float heading = 18; inline constexpr float body = 16; inline constexpr float label = 14; inline constexpr float caption = 12; } // Distances, in dp. namespace Size { inline constexpr float unit = 4; // every gap is a multiple of it inline constexpr float gutter = 16; // between content and the window's edge inline constexpr float touch = 48; // the least a finger can hit inline constexpr float control = 48; // a button's and a field's height inline constexpr float row = 64; // a list row with two lines inline constexpr float bar = 56; // the top and bottom bars inline constexpr float radius = 12; // cards and sheets inline constexpr float controlRadius = 8; inline constexpr float contentMax = 640; // a form or a list does not grow wider than this inline constexpr float pull = 64; // how far down a list is pulled before letting go reads it again } }