refactor theme
Some checks failed
Rust / build (ubuntu-latest, stable) (push) Failing after 1m46s
Rust / build (ubuntu-latest, stable) (pull_request) Failing after 1m35s

This commit is contained in:
2026-01-25 09:00:00 +07:00
parent 2f81753fff
commit cb4b7ff36d
41 changed files with 199 additions and 1446 deletions

View File

@@ -160,11 +160,7 @@ impl Theme {
theme.mode = mode;
// Set the theme colors
if mode.is_dark() {
theme.colors = *theme.theme.dark();
} else {
theme.colors = *theme.theme.light();
}
theme.colors = *theme.theme.colors();
// Refresh the window if available
if let Some(window) = window {
@@ -177,16 +173,18 @@ impl From<ThemeFamily> for Theme {
fn from(family: ThemeFamily) -> Self {
let platform = PlatformKind::platform();
let mode = ThemeMode::default();
// Define the theme colors based on the appearance
let colors = match mode {
ThemeMode::Light => family.light(),
ThemeMode::Dark => family.dark(),
let colors = family.colors();
// Define the font family based on the platform.
// TODO: Use native fonts on Linux too.
let font_family = match platform {
PlatformKind::Linux => "Inter",
_ => ".SystemUIFont",
};
Theme {
font_size: px(15.),
font_family: ".SystemUIFont".into(),
font_family: font_family.into(),
radius: px(5.),
radius_lg: px(10.),
shadow: true,