Themes

Themes control the colours of all plot chrome — background, axes, grid lines, tick marks, text, and legend. Plot data colours are not affected by themes; those come from the color passed to each plot or from a Palette.

Four built-in themes are available. The default is light.


Applying a theme

Rust API

#![allow(unused)]
fn main() {
use kuva::render::layout::Layout;
use kuva::render::theme::Theme;

let layout = Layout::auto_from_plots(&plots)
    .with_theme(Theme::dark());
}

CLI

kuva scatter data.tsv --x x --y y --theme dark
kuva bar data.tsv --label-col gene --value-col count --theme minimal

Available CLI values: light, dark, minimal, solarized.


Built-in themes

light (default)

White background, black axes and text, light gray grid lines.

PropertyValue
Backgroundwhite
Axes / ticks / textblack
Grid#ccc
Legend backgroundwhite
Legend borderblack
Fontsystem sans-serif
Grid shownyes

dark

Dark charcoal background, light gray text and axes.

PropertyValue
Background#1e1e1e
Axes / ticks#cccccc
Text#e0e0e0
Grid#444444
Legend background#2d2d2d
Legend border#666666
Fontsystem sans-serif
Grid shownyes

minimal

White background, no grid, serif font, no legend border. Suited for publication figures where grid lines add visual noise.

PropertyValue
Backgroundwhite
Axes / ticks / textblack
Grid#e0e0e0
Legend bordernone
Fontserif
Grid shownno

solarized

Warm cream background based on Ethan Schoonover's Solarized palette.

PropertyValue
Background#fdf6e3
Axes / ticks#586e75
Text#657b83
Grid#eee8d5
Legend background#fdf6e3
Legend border#93a1a1
Fontsystem sans-serif
Grid shownyes

Custom themes

Build a Theme struct directly to set any combination of properties:

#![allow(unused)]
fn main() {
use kuva::render::theme::Theme;

let theme = Theme {
    background: "#0d1117".into(),   // GitHub dark background
    axis_color: "#8b949e".into(),
    grid_color: "#21262d".into(),
    tick_color: "#8b949e".into(),
    text_color: "#c9d1d9".into(),
    legend_bg: "#161b22".into(),
    legend_border: "#30363d".into(),
    pie_leader: "#8b949e".into(),
    box_median: "#0d1117".into(),
    violin_border: "#8b949e".into(),
    colorbar_border: "#8b949e".into(),
    font_family: None,
    show_grid: true,
};

let layout = Layout::auto_from_plots(&plots).with_theme(theme);
}