// SPDX-License-Identifier: GPL-3.0-only // SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts® module Nostro.Ui:Theme_impl; import std; import :Theme; import :Geometry; using namespace Nostro::Ui; Theme Theme::Light() { return Theme(); } Theme Theme::Dark() { return Theme{ .background = {0.07f, 0.07f, 0.08f}, .surface = {0.12f, 0.12f, 0.13f}, .surfaceAlt = {0.18f, 0.18f, 0.20f}, .text = {0.93f, 0.93f, 0.94f}, .muted = {0.62f, 0.62f, 0.65f}, .accent = {0.36f, 0.58f, 0.98f}, .onAccent = {0.04f, 0.06f, 0.12f}, .divider = {0.20f, 0.20f, 0.22f}, .positive = {0.36f, 0.80f, 0.48f}, .warning = {0.30f, 0.26f, 0.10f}, .onWarning = {0.98f, 0.88f, 0.55f}, .danger = {0.95f, 0.42f, 0.42f}, .onDanger = {0.16f, 0.03f, 0.03f}, .scrim = {0.0f, 0.0f, 0.0f, 0.55f}, .dark = true, }; } void Theme::Accent(Color color) { const Color opaque = color.WithAlpha(1.0f); const Color onDark{1.0f, 1.0f, 1.0f}; const Color onBright{0.08f, 0.08f, 0.09f}; accent = opaque; onAccent = opaque.Luminance() > 0.6f ? onBright : onDark; } Color Theme::Hovered(Color color) const { return color.Mixed(text, 0.06f); } Color Theme::Pressed(Color color) const { return color.Mixed(text, 0.14f); } Color Theme::Taken() const { // A light theme's surface is the lighter of its two grounds; a dark theme's is the darker. return dark ? surfaceAlt.Mixed(text, 0.12f) : surface; }