Report theme changes to debug API
This commit is contained in:
parent
42f5a61809
commit
5f15522368
2 changed files with 28 additions and 3 deletions
|
|
@ -252,7 +252,7 @@ impl fmt::Display for Custom {
|
|||
}
|
||||
}
|
||||
|
||||
/// The base style of a [`Theme`].
|
||||
/// The base style of a theme.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub struct Style {
|
||||
/// The background [`Color`] of the application.
|
||||
|
|
@ -262,16 +262,27 @@ pub struct Style {
|
|||
pub text_color: Color,
|
||||
}
|
||||
|
||||
/// The default blank style of a [`Theme`].
|
||||
/// The default blank style of a theme.
|
||||
pub trait Base {
|
||||
/// Returns the default base [`Style`] of a [`Theme`].
|
||||
/// Returns the default base [`Style`] of a theme.
|
||||
fn base(&self) -> Style;
|
||||
|
||||
/// Returns the color [`Palette`] of the theme.
|
||||
///
|
||||
/// This [`Palette`] may be used by the runtime for
|
||||
/// debugging purposes; like displaying performance
|
||||
/// metrics or devtools.
|
||||
fn palette(&self) -> Option<Palette>;
|
||||
}
|
||||
|
||||
impl Base for Theme {
|
||||
fn base(&self) -> Style {
|
||||
default(self)
|
||||
}
|
||||
|
||||
fn palette(&self) -> Option<Palette> {
|
||||
Some(self.palette())
|
||||
}
|
||||
}
|
||||
|
||||
/// The default [`Style`] of a built-in [`Theme`].
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue