Skip to main content

Theme

Struct Theme 

Source
pub struct Theme {
Show 24 fields pub figure_background: Color, pub axes_background: Color, pub grid_color: Color, pub grid_width: f64, pub show_grid: bool, pub spine_color: Color, pub spine_width: f64, pub show_top_spine: bool, pub show_right_spine: bool, pub show_bottom_spine: bool, pub show_left_spine: bool, pub tick_color: Color, pub tick_length: f64, pub tick_direction: TickDirection, pub tick_label_size: f64, pub axis_label_size: f64, pub title_size: f64, pub title_weight: FontWeight, pub text_color: Color, pub line_width: f64, pub marker_size: f64, pub marker_alpha: f64, pub color_cycle: Vec<Color>, pub font_family: Option<String>,
}
Expand description

Visual theme controlling all rendering defaults.

Every visual parameter that a renderer or layout engine might need lives here. Chart builders read from the active theme to fill in any value the user did not override explicitly.

Fields§

§figure_background: Color

Background color for the entire figure (outside the axes area).

§axes_background: Color

Background color for the axes face (the data-drawing region).

§grid_color: Color

Color of major grid lines.

§grid_width: f64

Width (in px) of major grid lines.

§show_grid: bool

Whether the grid is shown by default (line/scatter: true; bar/hist: false).

§spine_color: Color

Color of visible axis spines.

§spine_width: f64

Width (in px) of axis spines.

§show_top_spine: bool

Whether the top spine is drawn.

§show_right_spine: bool

Whether the right spine is drawn.

§show_bottom_spine: bool

Whether the bottom spine is drawn.

§show_left_spine: bool

Whether the left spine is drawn.

§tick_color: Color

Color of tick marks and tick labels.

§tick_length: f64

Length (in px) of major tick marks.

§tick_direction: TickDirection

Direction ticks extend from the spine.

§tick_label_size: f64

Font size (in pt) for tick labels.

§axis_label_size: f64

Font size (in pt) for axis labels.

§title_size: f64

Font size (in pt) for the plot title.

§title_weight: FontWeight

Font weight for the plot title.

§text_color: Color

Color used for all text (titles, labels, tick labels).

§line_width: f64

Default line width (in px) for line plots.

§marker_size: f64

Default marker diameter (in px) for scatter plots.

§marker_alpha: f64

Default marker opacity (0.0 = fully transparent, 1.0 = fully opaque).

§color_cycle: Vec<Color>

Categorical color cycle used when the user does not specify colors.

§font_family: Option<String>

Optional font family override. None means the renderer picks its built-in default (typically a clean sans-serif such as Helvetica).

Implementations§

Source§

impl Theme

Source

pub fn dark() -> Self

Dark theme with a near-black background and bright, neon-ish data colors.

Suited for dashboards and presentations on dark backgrounds.

Source

pub fn seaborn() -> Self

Seaborn-inspired theme with a tinted axes background and white grid.

Mimics the popular seaborn "whitegrid" aesthetic: a pale blue-grey axes face (#EAEAF2) with white grid lines over it. Top and right spines are hidden for the characteristic despined look. Grid lines are slightly thicker than default for visual weight against the tinted background. Uses a muted color palette via Tableau-10 and a sans-serif font family.

Source

pub fn ggplot() -> Self

ggplot2-inspired theme with a grey panel and white grid.

Reproduces the characteristic look of R’s ggplot2: a medium-grey panel (#E5E5E5), white major grid lines, a thin panel border around all four sides, and the ggplot2 default qualitative palette. The title is rendered bold in the classic ggplot2 aesthetic.

Source

pub fn publication() -> Self

Publication-ready theme: crisp, minimal, and suitable for print.

Designed for journal submissions and academic papers at 300+ DPI:

  • Pure white background, no grid by default.
  • All four thin black spines (0.5 px) for a complete panel frame.
  • Inward ticks for a compact footprint that does not intrude on margins.
  • Larger axis labels (12 pt) for readability at reduced figure sizes.
  • Serif font family for traditional academic aesthetics.
Source

pub fn nature() -> Self

Nature/Science journal theme: ultra-clean and compact.

Inspired by the house style of top scientific journals such as Nature and Science:

  • White background with no unnecessary decoration.
  • Bold axis labels for immediate readability in multi-panel figures.
  • Thin spines (0.75 px) on bottom and left only; top and right hidden.
  • Compact font sizes suited for narrow column widths.
  • Sans-serif font family (Helvetica/Arial style) per journal guidelines.
Source

pub fn solarized() -> Self

Solarized dark theme based on the Solarized color scheme by Ethan Schoonover.

Uses the base03 background (#002B36) with Solarized content tones for text (#839496) and accent colors for data series. The result is a low-contrast, eye-friendly palette designed for extended viewing.

This is the dark variant. A light variant could be built by swapping base03/base0 roles.

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

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

impl Default for Theme

Source§

fn default() -> Self

Returns the canonical default theme matching the Visual Design Brief.

  • Background: #FFFFFF, axes face: #FFFFFF
  • Grid: #E6E6E6, 1 px, shown by default
  • Spines: #333333, 1 px, top + right hidden (despine look)
  • Ticks: outward, 4 px, #333333
  • Font sizes: title 14 pt bold, axis labels 11 pt, tick labels 9 pt
  • Text color: #333333
  • Line width 1.5 px, marker 6 px diameter, marker alpha 0.8
  • Tableau-10 color cycle

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> 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<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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.