Set window theme to match color scheme of active theme

This commit is contained in:
Héctor Ramón Jiménez 2025-09-08 10:12:04 +02:00
parent e92c87061d
commit 74425d5cb1
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
4 changed files with 40 additions and 6 deletions

View file

@ -258,7 +258,10 @@ pub trait Base {
/// Returns the default theme for the preferred [`Mode`].
fn default(preference: Mode) -> Self;
/// Returns the default base [`Style`] of a theme.
/// Returns the [`Mode`] of the theme.
fn mode(&self) -> Mode;
/// Returns the default base [`Style`] of the theme.
fn base(&self) -> Style;
/// Returns the color [`Palette`] of the theme.
@ -295,6 +298,14 @@ impl Base for Theme {
}
}
fn mode(&self) -> Mode {
if self.extended_palette().is_dark {
Mode::Dark
} else {
Mode::Light
}
}
fn base(&self) -> Style {
default(self)
}