facett-core 0.1.6

facett — visual kernel: render a node/edge Scene into egui (wgpu fast path to come)
Documentation
//! **Preset palettes** — semantic [`Palette`]s authored in OKLCH for each preset,
//! tuned so the WCAG 2.2 gate passes (§7): body text ≥ 4.5:1, dim/large ≥ 3:1,
//! UI boundaries ≥ 3:1, status on-colours ≥ 4.5:1, in **both** light and dark.

use super::oklch::Oklch;
use super::palette::Palette;

/// Status roles shared across presets (hues are perceptual constants; lightness
/// is tuned per light/dark so the `on_*` contrast holds).
fn status_dark() -> (Oklch, Oklch, Oklch, Oklch, Oklch, Oklch) {
    // (success, on_success, warn, on_warn, error, on_error)
    (
        Oklch::new(0.72, 0.16, 150.0),
        Oklch::new(0.16, 0.02, 150.0),
        Oklch::new(0.80, 0.15, 85.0),
        Oklch::new(0.18, 0.03, 85.0),
        Oklch::new(0.58, 0.20, 25.0),
        Oklch::new(0.99, 0.0, 0.0),
    )
}
fn status_light() -> (Oklch, Oklch, Oklch, Oklch, Oklch, Oklch) {
    (
        Oklch::new(0.50, 0.14, 150.0),
        Oklch::new(0.99, 0.0, 0.0),
        Oklch::new(0.78, 0.13, 85.0),
        Oklch::new(0.15, 0.02, 85.0),
        Oklch::new(0.52, 0.20, 25.0),
        Oklch::new(0.99, 0.0, 0.0),
    )
}

pub fn windows_dark_palette() -> Palette {
    let (success, on_success, warn, on_warn, error, on_error) = status_dark();
    Palette {
        dark: true,
        surface: Oklch::new(0.18, 0.012, 255.0),
        on_surface: Oklch::new(0.93, 0.01, 255.0),
        on_surface_dim: Oklch::new(0.68, 0.012, 255.0),
        surface_container: Oklch::new(0.24, 0.014, 255.0),
        surface_extreme: Oklch::new(0.13, 0.012, 255.0),
        primary: Oklch::new(0.70, 0.14, 245.0),
        on_primary: Oklch::new(0.16, 0.02, 245.0),
        accent: Oklch::new(0.74, 0.13, 235.0),
        outline: Oklch::new(0.58, 0.02, 255.0),
        selection: Oklch::new(0.62, 0.12, 245.0),
        success,
        on_success,
        warn,
        on_warn,
        error,
        on_error,
        glow: Oklch::new(0.78, 0.13, 235.0),
    }
}

pub fn windows_light_palette() -> Palette {
    let (success, on_success, warn, on_warn, error, on_error) = status_light();
    Palette {
        dark: false,
        surface: Oklch::new(0.985, 0.003, 255.0),
        on_surface: Oklch::new(0.22, 0.012, 255.0),
        on_surface_dim: Oklch::new(0.45, 0.012, 255.0),
        surface_container: Oklch::new(0.94, 0.005, 255.0),
        surface_extreme: Oklch::new(1.0, 0.0, 0.0),
        primary: Oklch::new(0.46, 0.16, 250.0),
        on_primary: Oklch::new(0.99, 0.0, 0.0),
        accent: Oklch::new(0.46, 0.16, 250.0),
        outline: Oklch::new(0.50, 0.02, 255.0),
        selection: Oklch::new(0.58, 0.14, 250.0),
        success,
        on_success,
        warn,
        on_warn,
        error,
        on_error,
        glow: Oklch::new(0.55, 0.16, 250.0),
    }
}

pub fn macos_dark_palette() -> Palette {
    let (success, on_success, warn, on_warn, error, on_error) = status_dark();
    Palette {
        dark: true,
        surface: Oklch::new(0.20, 0.006, 280.0),
        on_surface: Oklch::new(0.95, 0.004, 280.0),
        on_surface_dim: Oklch::new(0.70, 0.006, 280.0),
        surface_container: Oklch::new(0.26, 0.008, 280.0),
        surface_extreme: Oklch::new(0.14, 0.006, 280.0),
        primary: Oklch::new(0.68, 0.16, 255.0),
        on_primary: Oklch::new(0.16, 0.02, 255.0),
        accent: Oklch::new(0.72, 0.15, 250.0),
        outline: Oklch::new(0.58, 0.01, 280.0),
        selection: Oklch::new(0.62, 0.14, 255.0),
        success,
        on_success,
        warn,
        on_warn,
        error,
        on_error,
        glow: Oklch::new(0.76, 0.14, 250.0),
    }
}

pub fn macos_light_palette() -> Palette {
    let (success, on_success, warn, on_warn, error, on_error) = status_light();
    Palette {
        dark: false,
        surface: Oklch::new(0.99, 0.002, 280.0),
        on_surface: Oklch::new(0.20, 0.006, 280.0),
        on_surface_dim: Oklch::new(0.44, 0.006, 280.0),
        surface_container: Oklch::new(0.95, 0.004, 280.0),
        surface_extreme: Oklch::new(1.0, 0.0, 0.0),
        primary: Oklch::new(0.50, 0.17, 255.0),
        on_primary: Oklch::new(0.99, 0.0, 0.0),
        accent: Oklch::new(0.48, 0.17, 255.0),
        outline: Oklch::new(0.54, 0.012, 280.0),
        selection: Oklch::new(0.58, 0.15, 255.0),
        success,
        on_success,
        warn,
        on_warn,
        error,
        on_error,
        glow: Oklch::new(0.55, 0.17, 255.0),
    }
}

/// Device — maximum contrast, near-monochrome, sunlight-legible. Dark ground,
/// near-white text, a single high-contrast amber accent (sunlight-friendly),
/// crisp outlines. No transparency anywhere (effects off, §23).
pub fn device_palette() -> Palette {
    Palette {
        dark: true,
        surface: Oklch::new(0.14, 0.0, 0.0),
        on_surface: Oklch::new(0.98, 0.0, 0.0),
        on_surface_dim: Oklch::new(0.80, 0.0, 0.0),
        surface_container: Oklch::new(0.20, 0.0, 0.0),
        surface_extreme: Oklch::new(0.08, 0.0, 0.0),
        primary: Oklch::new(0.80, 0.16, 85.0), // amber, high-vis
        on_primary: Oklch::new(0.10, 0.02, 85.0),
        accent: Oklch::new(0.82, 0.16, 85.0),
        outline: Oklch::new(0.78, 0.0, 0.0), // bright crisp hairline
        selection: Oklch::new(0.80, 0.16, 85.0),
        success: Oklch::new(0.82, 0.20, 150.0),
        on_success: Oklch::new(0.10, 0.02, 150.0),
        warn: Oklch::new(0.85, 0.17, 90.0),
        on_warn: Oklch::new(0.10, 0.02, 90.0),
        error: Oklch::new(0.70, 0.22, 25.0),
        on_error: Oklch::new(0.10, 0.02, 25.0),
        glow: Oklch::new(0.82, 0.16, 85.0),
    }
}