use super::cascade::PerChannel;
use super::element::{Element, LineElement};
use super::palette::{Palette, ThemeColor};
use super::theme::Theme;
use crate::color::{rgb, Color};
impl Theme {
pub fn dark() -> Self {
Theme::default().invert()
}
#[allow(clippy::field_reassign_with_default)]
pub fn minimal() -> Self {
let mut t = Theme::default();
t.palette.paper = rgb(1.0, 1.0, 1.0);
t.panel_border = Element::Blank;
t.panel_grid_minor = PerChannel {
all: Element::Blank,
by_channel: [Element::Inherit, Element::Inherit],
};
t
}
#[allow(clippy::field_reassign_with_default)]
pub fn classic() -> Self {
let mut t = Theme::default();
t.palette.paper = rgb(1.0, 1.0, 1.0);
t.panel_border = Element::Blank;
t.panel_grid_major = PerChannel {
all: Element::Blank,
by_channel: [Element::Inherit, Element::Inherit],
};
t.panel_grid_minor = PerChannel {
all: Element::Blank,
by_channel: [Element::Inherit, Element::Inherit],
};
t
}
#[allow(clippy::field_reassign_with_default)]
pub fn bw() -> Self {
let mut t = Theme::default();
t.palette = Palette {
paper: rgb(1.0, 1.0, 1.0),
ink: rgb(0.0, 0.0, 0.0),
accent: rgb(0.3, 0.3, 0.3),
};
t.panel_grid_major = PerChannel::new(LineElement {
color: Some(ThemeColor::mix(ThemeColor::Paper, ThemeColor::Ink, 0.22)),
..LineElement::default()
});
t.panel_grid_minor = PerChannel::new(LineElement {
color: Some(ThemeColor::mix(ThemeColor::Paper, ThemeColor::Ink, 0.10)),
..LineElement::default()
});
t
}
#[allow(clippy::field_reassign_with_default)]
pub fn void() -> Self {
let mut t = Theme::default();
t.palette.paper = rgb(1.0, 1.0, 1.0);
t.panel_background = Element::Blank;
t.panel_border = Element::Blank;
t.panel_grid_major = PerChannel {
all: Element::Blank,
by_channel: [Element::Inherit, Element::Inherit],
};
t.panel_grid_minor = PerChannel {
all: Element::Blank,
by_channel: [Element::Inherit, Element::Inherit],
};
t.axis = super::axis::PerAxis::new(super::axis::AxisTheme {
title: Element::Blank,
text: Element::Blank,
line: Element::Blank,
ticks: Element::Blank,
ticks_minor: Element::Blank,
..super::axis::AxisTheme::default()
});
t
}
pub fn with_palette_anchors(self, paper: Color, ink: Color, accent: Color) -> Self {
self.with_palette(Palette::new(paper, ink, accent))
}
}