/* Crafter®.Graphics Copyright (C) 2026 Catcrafts® catcrafts.net This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3.0 as published by the Free Software Foundation; This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ export module Crafter.Graphics:UITheme; import std; import :UILength; import :UIWidgets; import :Font; export namespace Crafter::UI { // Flat theme — named slots, no cascading. Users keep one Theme value // (typically as a member of their scene) and reference its slots on // each widget via `.style(theme.primary)` etc. No automatic // propagation: per-widget overrides win. struct Theme { // Buttons ButtonStyle primary; // default action ("Save", "Play") ButtonStyle secondary; // neutral action ("Cancel", "Back") ButtonStyle danger; // destructive ("Delete", "Quit") ButtonStyle disabled; // greyed out // Inputs InputFieldStyle input; // Generic palette Color text {0.95f, 0.95f, 0.95f, 1.0f}; Color textMuted {0.65f, 0.65f, 0.65f, 1.0f}; Color panel {0.10f, 0.11f, 0.13f, 1.0f}; Color panelElevated {0.14f, 0.15f, 0.17f, 1.0f}; Color border {0.30f, 0.30f, 0.30f, 1.0f}; Color focusRing {0.40f, 0.70f, 1.00f, 1.0f}; // Typography. Optional: not every widget requires the theme's font; // builder methods can override per-instance. Font* defaultFont = nullptr; float defaultFontSize = 16.0f; }; namespace themes { // A balanced dark-mode theme — matches the kind of game-menu palette // 3DForts uses. Users can copy + tweak. inline Theme default_dark() { Theme t; t.primary.background = Color{0.22f, 0.45f, 0.78f, 1.0f}; t.primary.hoverBackground = Color{0.28f, 0.55f, 0.92f, 1.0f}; t.primary.pressedBackground = Color{0.16f, 0.36f, 0.66f, 1.0f}; t.primary.textColor = Color{1.0f, 1.0f, 1.0f, 1.0f}; t.secondary.background = Color{0.20f, 0.20f, 0.20f, 1.0f}; t.secondary.hoverBackground = Color{0.28f, 0.28f, 0.28f, 1.0f}; t.secondary.pressedBackground = Color{0.14f, 0.14f, 0.14f, 1.0f}; t.danger.background = Color{0.62f, 0.20f, 0.20f, 1.0f}; t.danger.hoverBackground = Color{0.78f, 0.26f, 0.26f, 1.0f}; t.danger.pressedBackground = Color{0.46f, 0.14f, 0.14f, 1.0f}; t.danger.textColor = Color{1.0f, 0.95f, 0.95f, 1.0f}; t.disabled.background = Color{0.15f, 0.15f, 0.15f, 1.0f}; t.disabled.textColor = Color{0.50f, 0.50f, 0.50f, 1.0f}; return t; } } }