Skip to main content

Theme

Struct Theme 

Source
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

Source

pub fn surfaces(&self) -> &SurfaceTheme

Borrow the complete surfaces component.

Source

pub fn typography(&self) -> &TypographyTheme

Borrow the complete typography component.

Source

pub fn axes(&self) -> &AxisTheme

Borrow the complete axes component.

Source

pub fn legend(&self) -> &LegendTheme

Borrow the complete legend component.

Source

pub fn composition(&self) -> &CompositionTheme

Borrow the complete composition component.

Source

pub fn marks(&self) -> &MarkTheme

Borrow the complete marks component.

Source

pub fn annotations(&self) -> &AnnotationTheme

Borrow the complete annotations component.

Source

pub fn color_scales(&self) -> &ColorScales

Borrow the complete color_scales component.

Source§

impl Theme

Source

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.

Source

pub fn new( surfaces: SurfaceTheme, typography: TypographyTheme, axes: AxisTheme, legend: LegendTheme, composition: CompositionTheme, marks: MarkTheme, annotations: AnnotationTheme, color_scales: ColorScales, ) -> Result<Theme, Error>

Construct all eight complete components without discovering fonts or data domains.

Source

pub fn publication() -> Theme

Clean high-contrast publication appearance with generous whitespace.

Source

pub fn nature() -> Theme

Muted blues and greens with bottom/left coordinate frame sides.

Source

pub fn science() -> Theme

High-saturation scientific palette and emphasized axes.

Source

pub fn chi() -> Theme

Accessible pastel appearance for HCI publications.

Source

pub fn customize(&self) -> ThemeBuilder

Start a complete construction-only working copy, leaving this value unchanged.

Trait Implementations§

Source§

impl Clone for Theme

Source§

fn clone(&self) -> Theme

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Theme

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Theme

Source§

fn eq(&self, other: &Theme) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Theme

Auto Trait Implementations§

§

impl Forget for Theme

§

impl Freeze for Theme
where *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
where Arc<Vec<FontFamily>>: Send, Arc<SpacingPayload>: Send, Arc<Vec<OpaqueColor>>: Send, Arc<Vec<ColorStop>>: Send,

§

impl Sync for Theme
where Arc<Vec<FontFamily>>: Sync, Arc<SpacingPayload>: Sync, Arc<Vec<OpaqueColor>>: Sync, Arc<Vec<ColorStop>>: Sync,

§

impl Unpin for Theme
where Arc<Vec<FontFamily>>: Unpin, Arc<SpacingPayload>: Unpin, Arc<Vec<OpaqueColor>>: Unpin, Arc<Vec<ColorStop>>: Unpin,

§

impl UnsafeUnpin for Theme
where *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 Theme

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V