pub struct Theme {
pub dark: bool,
pub ui: UiColors,
pub chart: ChartColors,
pub text: TextSizes,
pub spacing: Spacing,
pub radius: Radii,
}Expand description
The colours and scales of the UI and the chart.
With the serde feature, a theme serialises with any serde format. The dark
flag and both complete colour palettes are required; omitted text, spacing and
radius scales use their defaults. Colours are egui’s premultiplied [r, g, b, a]
arrays.
Fields§
§dark: boolWhether the UI is dark: selects egui’s base visuals and the shadow strength.
ui: UiColorsColours of the UI chrome: panels, text, controls and status.
chart: ChartColorsColours of the chart surface.
text: TextSizesType scale and chart text roles, also applied to egui’s built-in text styles.
spacing: SpacingSpacing scale.
radius: RadiiCorner radius scale.
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn high_contrast() -> Self
pub fn high_contrast() -> Self
Black surfaces with white text, for low vision and bright surroundings.
Every text colour except disabled text reads at 7:1 or better on panels and windows, and outlines and the focus ring at 4.5:1 or better.
Source§impl Theme
impl Theme
Sourcepub fn with_accent(self, accent: Color32) -> Self
pub fn with_accent(self, accent: Color32) -> Self
This theme with accent as its accent colour.
Also derives opaque hover and pressed shades at least 1.2:1 apart, black or white text reading at 4.5:1 on every shade, a selection at least 1.3:1 from the panel, and a light theme’s focus ring. These overrides promise 4.5:1 text contrast rather than the high-contrast preset’s 7:1.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Theme
impl<'de> Deserialize<'de> for Theme
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for Theme
Auto Trait Implementations§
impl Freeze for Theme
impl RefUnwindSafe for Theme
impl Send for Theme
impl Sync for Theme
impl Unpin for Theme
impl UnsafeUnpin for Theme
impl UnwindSafe for Theme
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more