arael-sketch 0.6.2

Interactive 2D sketch editor with real-time constraint solving
// Color scheme for the sketch editor canvas.

use eframe::egui;

#[derive(Clone)]
pub struct ColorScheme {
    pub background: egui::Color32,
    pub grid: egui::Color32,
    pub origin: egui::Color32,
    pub line: egui::Color32,
    pub line_hover: egui::Color32,
    pub line_selected: egui::Color32,
    pub endpoint: egui::Color32,
    pub endpoint_selected: egui::Color32,
    pub endpoint_line_selected: egui::Color32,
    pub point: egui::Color32,
    pub point_selected: egui::Color32,
    pub point_locked: egui::Color32,
    pub arc: egui::Color32,
    pub construction: egui::Color32,
    pub constraint_marker: egui::Color32,
    pub preview_line: egui::Color32,
    pub status_text: egui::Color32,
    pub highlight: egui::Color32,
    pub constraint_marker_selected: egui::Color32,
    pub dimension: egui::Color32,
    pub dimension_selected: egui::Color32,
    pub dimension_hover: egui::Color32,
    pub dimension_broken: egui::Color32,
    pub dimension_preview: egui::Color32,
    pub error_text: egui::Color32,
    pub command_cursor: egui::Color32,
}

impl ColorScheme {
    pub fn light() -> Self {
        ColorScheme {
            background: egui::Color32::from_gray(255),
            grid: egui::Color32::from_gray(220),
            origin: egui::Color32::from_rgb(180, 180, 180),
            line: egui::Color32::from_rgb(50, 140, 180),
            line_hover: egui::Color32::from_rgb(30, 90, 180),
            line_selected: egui::Color32::from_rgb(20, 50, 150),
            endpoint: egui::Color32::from_rgb(100, 180, 255),
            endpoint_selected: egui::Color32::from_rgb(20, 60, 140),
            endpoint_line_selected: egui::Color32::from_rgb(50, 100, 180),
            point: egui::Color32::from_rgb(100, 180, 255),
            point_selected: egui::Color32::from_rgb(20, 60, 140),
            point_locked: egui::Color32::from_rgb(0, 180, 0),
            arc: egui::Color32::from_rgb(50, 140, 180),
            construction: egui::Color32::from_rgb(180, 130, 50),
            constraint_marker: egui::Color32::from_rgb(0, 160, 0),
            preview_line: egui::Color32::from_rgba_premultiplied(50, 140, 180, 180),
            status_text: egui::Color32::from_gray(80),
            highlight: egui::Color32::from_rgb(255, 120, 180),
            constraint_marker_selected: egui::Color32::from_rgb(255, 120, 180),
            dimension: egui::Color32::from_rgb(200, 100, 50),
            dimension_selected: egui::Color32::from_rgb(255, 120, 180),
            dimension_hover: egui::Color32::from_rgb(230, 130, 70),
            dimension_broken: egui::Color32::from_rgb(255, 30, 30),
            dimension_preview: egui::Color32::from_rgba_premultiplied(200, 100, 50, 180),
            error_text: egui::Color32::from_rgb(255, 80, 80),
            command_cursor: egui::Color32::from_rgb(0, 160, 255),
        }
    }

    pub fn dark() -> Self {
        ColorScheme {
            background: egui::Color32::from_gray(30),
            grid: egui::Color32::from_gray(45),
            origin: egui::Color32::from_rgb(80, 80, 80),
            line: egui::Color32::from_rgb(200, 200, 200),
            line_hover: egui::Color32::from_rgb(255, 210, 130),
            line_selected: egui::Color32::from_rgb(255, 180, 50),
            endpoint: egui::Color32::from_rgb(100, 180, 255),
            endpoint_selected: egui::Color32::from_rgb(255, 180, 50),
            endpoint_line_selected: egui::Color32::from_rgb(255, 220, 100),
            point: egui::Color32::from_rgb(100, 180, 255),
            point_selected: egui::Color32::from_rgb(255, 180, 50),
            point_locked: egui::Color32::from_rgb(0, 200, 0),
            arc: egui::Color32::from_rgb(200, 200, 200),
            construction: egui::Color32::from_rgb(140, 100, 40),
            constraint_marker: egui::Color32::from_rgb(100, 255, 100),
            preview_line: egui::Color32::from_rgba_premultiplied(200, 200, 200, 128),
            status_text: egui::Color32::from_gray(150),
            highlight: egui::Color32::from_rgb(255, 120, 180),
            constraint_marker_selected: egui::Color32::from_rgb(255, 120, 180),
            dimension: egui::Color32::from_rgb(220, 140, 80),
            dimension_selected: egui::Color32::from_rgb(255, 120, 180),
            dimension_hover: egui::Color32::from_rgb(245, 170, 100),
            dimension_broken: egui::Color32::from_rgb(255, 60, 60),
            dimension_preview: egui::Color32::from_rgba_premultiplied(220, 140, 80, 180),
            error_text: egui::Color32::from_rgb(255, 100, 100),
            command_cursor: egui::Color32::from_rgb(0, 160, 255),
        }
    }
}