Trait kas_core::theme::ThemeControl
source · pub trait ThemeControl {
// Required methods
fn set_font_size(&mut self, pt_size: f32) -> Action;
fn active_scheme(&self) -> &str;
fn list_schemes(&self) -> Vec<&str>;
fn get_scheme(&self, name: &str) -> Option<&ColorsSrgb>;
fn get_colors(&self) -> &ColorsLinear;
fn set_colors(&mut self, name: String, scheme: ColorsLinear) -> Action;
// Provided methods
fn set_scheme(&mut self, name: &str) -> Action { ... }
fn set_theme(&mut self, _theme: &str) -> Action { ... }
}Expand description
Interface through which a theme can be adjusted at run-time
All methods return a Action to enable correct action when a theme
is updated via EventCx::adjust_theme. When adjusting a theme before
the UI is started, this return value can be safely ignored.
Required Methods§
sourcefn set_font_size(&mut self, pt_size: f32) -> Action
fn set_font_size(&mut self, pt_size: f32) -> Action
Set font size
Units: Points per Em (standard unit of font size)
sourcefn active_scheme(&self) -> &str
fn active_scheme(&self) -> &str
Get the name of the active color scheme
sourcefn list_schemes(&self) -> Vec<&str>
fn list_schemes(&self) -> Vec<&str>
List available color schemes
sourcefn get_scheme(&self, name: &str) -> Option<&ColorsSrgb>
fn get_scheme(&self, name: &str) -> Option<&ColorsSrgb>
Get colors of a named scheme
sourcefn get_colors(&self) -> &ColorsLinear
fn get_colors(&self) -> &ColorsLinear
Access the in-use color scheme
sourcefn set_colors(&mut self, name: String, scheme: ColorsLinear) -> Action
fn set_colors(&mut self, name: String, scheme: ColorsLinear) -> Action
Set colors directly
This may be used to provide a custom color scheme. The name is
compulsary (and returned by Self::active_scheme).
The name is also used when saving config, though the custom colors are
not currently saved in this config.
Provided Methods§
sourcefn set_scheme(&mut self, name: &str) -> Action
fn set_scheme(&mut self, name: &str) -> Action
Change the color scheme
If no scheme by this name is found the scheme is left unchanged.
sourcefn set_theme(&mut self, _theme: &str) -> Action
fn set_theme(&mut self, _theme: &str) -> Action
Switch the theme
Most themes do not react to this method; super::MultiTheme uses
it to switch themes.