teksilo_core/styles/theme_appearance.rs
1// SPDX-License-Identifier: MPL-2.0
2// SPDX-FileCopyrightText: 2026 FernTech
3
4//! Light vs Dark surface declaration.
5//!
6//! Required field on every [`Theme`](crate::styles::Theme). Drives:
7//!
8//! - Per-component shadow density (dark themes need higher shadow alphas
9//! to read on dark surfaces).
10//! - OS-theme matching (light/dark mode auto-switching reads this off
11//! the active theme).
12//! - Asset variant selection (logos, icons that ship light/dark pairs).
13//!
14//! Independent of which preset built the theme: an `intui::light()`
15//! theme and a hypothetical `material3::light()` theme both report
16//! [`ThemeAppearance::Light`].
17
18use serde::{Deserialize, Serialize};
19
20#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Serialize, Deserialize)]
21pub enum ThemeAppearance {
22 Light,
23 Dark,
24}
25
26impl ThemeAppearance {
27 pub fn is_dark(self) -> bool {
28 matches!(self, ThemeAppearance::Dark)
29 }
30
31 pub fn is_light(self) -> bool {
32 matches!(self, ThemeAppearance::Light)
33 }
34}