Skip to main content

lichtung_plot/
style.rs

1//! Shared mark styles and paint values.
2
3/// Named line patterns used by all stroke roles.
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
5#[non_exhaustive]
6pub enum LinePattern {
7    /// Continuous stroke.
8    #[default]
9    Solid,
10    /// Fixed `3 2` dash and gap lengths.
11    ShortDash,
12    /// Fixed `4 3` dash and gap lengths.
13    MediumDash,
14    /// Fixed `5 3` dash and gap lengths.
15    Dashed,
16}
17
18impl LinePattern {
19    pub(crate) const fn svg_dasharray(self) -> Option<&'static str> {
20        match self {
21            Self::Solid => None,
22            Self::ShortDash => Some("3 2"),
23            Self::MediumDash => Some("4 3"),
24            Self::Dashed => Some("5 3"),
25        }
26    }
27}
28
29pub use crate::spec::PointShape;
30pub use crate::theme::paint::OpaqueColor;