Skip to main content

lichtung_plot/
scales.rs

1//! Scientific color and opacity encodings.
2
3use crate::{Color, NumericValues};
4
5/// A complete authored color source: one fixed paint or aligned numeric values.
6#[derive(Debug, Clone)]
7#[non_exhaustive]
8pub enum ColorSource {
9    /// A fixed complete color, with no data-scale or guide.
10    Fixed(Color),
11    /// Numeric observations to be mapped through a continuous scale.
12    Numeric(NumericValues),
13}
14
15impl From<Color> for ColorSource {
16    fn from(color: Color) -> Self {
17        Self::Fixed(color)
18    }
19}
20
21impl From<NumericValues> for ColorSource {
22    fn from(values: NumericValues) -> Self {
23        Self::Numeric(values)
24    }
25}
26
27pub use crate::alpha::{AlphaEncoding, AlphaMapping, AlphaSemantics, AlphaValues};
28pub use crate::spec::CategoricalColorMap;
29pub use crate::theme::scale_values::{
30    AccentPalette, CategoricalColorScale, ColorDomain, ColorStop, ContinuousColorScale,
31    ContinuousScaleKind, DivergingGradient, PaletteCapacity, QualitativePalette,
32    SequentialGradient,
33};