pub struct Theme { /* private fields */ }Expand description
Complete immutable appearance, independent of fonts discovered during rendering.
Built-in constructors return ordinary complete values. Customize a cloned
value with Theme::customize and attach the built result to a Plot or Canvas.
use lichtung_plot::{Color, Theme};
let base = Theme::publication();
let title = base.typography().get_root().get_title().clone()
.color(Color::hex("#194A75")?)?;
let root = base.typography().get_root().clone().title(title)?;
let typography = base.typography().clone().root(root)?;
let custom = base.customize().typography(typography).build()?;
assert_ne!(custom.typography(), base.typography());Built-ins are complete values, not closed selector variants:
let _ = lichtung_plot::Theme::Publication;Resolution is private:
let _ = lichtung_plot::Theme::publication().resolve();Implementations§
Source§impl Theme
impl Theme
Sourcepub fn surfaces(&self) -> &SurfaceTheme
pub fn surfaces(&self) -> &SurfaceTheme
Borrow the complete surfaces component.
Sourcepub fn typography(&self) -> &TypographyTheme
pub fn typography(&self) -> &TypographyTheme
Borrow the complete typography component.
Sourcepub fn legend(&self) -> &LegendTheme
pub fn legend(&self) -> &LegendTheme
Borrow the complete legend component.
Sourcepub fn composition(&self) -> &CompositionTheme
pub fn composition(&self) -> &CompositionTheme
Borrow the complete composition component.
Sourcepub fn annotations(&self) -> &AnnotationTheme
pub fn annotations(&self) -> &AnnotationTheme
Borrow the complete annotations component.
Sourcepub fn color_scales(&self) -> &ColorScales
pub fn color_scales(&self) -> &ColorScales
Borrow the complete color_scales component.
Source§impl Theme
impl Theme
Sourcepub fn with_context<R>(&self, f: impl FnOnce() -> R) -> R
pub fn with_context<R>(&self, f: impl FnOnce() -> R) -> R
Supply a construction default for new plots and canvases in a synchronous closure. Existing configurations and render operations remain independent of the scope. Nested scopes restore their predecessor, including on unwind.
This is thread-local, not task-local: returning a Future does not extend the scope to its later polling.
Sourcepub fn new(
surfaces: SurfaceTheme,
typography: TypographyTheme,
axes: AxisTheme,
legend: LegendTheme,
composition: CompositionTheme,
marks: MarkTheme,
annotations: AnnotationTheme,
color_scales: ColorScales,
) -> Result<Self>
pub fn new( surfaces: SurfaceTheme, typography: TypographyTheme, axes: AxisTheme, legend: LegendTheme, composition: CompositionTheme, marks: MarkTheme, annotations: AnnotationTheme, color_scales: ColorScales, ) -> Result<Self>
Construct all eight complete components without discovering fonts or data domains.
Sourcepub fn publication() -> Self
pub fn publication() -> Self
Clean high-contrast publication appearance with generous whitespace.
Sourcepub fn customize(&self) -> ThemeBuilder
pub fn customize(&self) -> ThemeBuilder
Start a complete construction-only working copy, leaving this value unchanged.
Trait Implementations§
impl StructuralPartialEq for Theme
Auto Trait Implementations§
impl Forget for Theme
impl Freeze for Themewhere
*const ArcInner<Vec<FontFamily>> is !null: Freeze,
PhantomData<ArcInner<Vec<FontFamily>>>: Freeze,
*const ArcInner<SpacingPayload> is !null: Freeze,
PhantomData<ArcInner<SpacingPayload>>: Freeze,
*const ArcInner<Vec<OpaqueColor>> is !null: Freeze,
PhantomData<ArcInner<Vec<OpaqueColor>>>: Freeze,
*const ArcInner<Vec<ColorStop>> is !null: Freeze,
PhantomData<ArcInner<Vec<ColorStop>>>: Freeze,
impl Move for Theme
impl RefUnwindSafe for Theme
impl Send for Theme
impl Sync for Theme
impl Unpin for Theme
impl UnsafeUnpin for Themewhere
*const ArcInner<Vec<FontFamily>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Vec<FontFamily>>>: UnsafeUnpin,
*const ArcInner<SpacingPayload> is !null: UnsafeUnpin,
PhantomData<ArcInner<SpacingPayload>>: UnsafeUnpin,
*const ArcInner<Vec<OpaqueColor>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Vec<OpaqueColor>>>: UnsafeUnpin,
*const ArcInner<Vec<ColorStop>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Vec<ColorStop>>>: UnsafeUnpin,
impl UnwindSafe for Themewhere
Arc<Vec<FontFamily>>: UnwindSafe,
Arc<SpacingPayload>: UnwindSafe,
Arc<Vec<OpaqueColor>>: UnwindSafe,
Arc<Vec<ColorStop>>: UnwindSafe,
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> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.