1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright © 2025 The µcad authors <info@ucad.xyz>
// SPDX-License-Identifier: AGPL-3.0-or-later
//! Color theme
use crate::color::Color;
/// Represents a color theme.
#[derive(Clone, Debug, PartialEq)]
pub struct Theme {
/// Name of the theme.
pub name: String,
/// Filename of the theme, if it was loaded from file.
pub filename: Option<String>,
/// Background color of the drawing canvas
pub background: Color,
/// Color used for grid lines
pub grid: Color,
/// Color used for selected entities
pub selection: Color,
/// Color used for highlighting hovered entities
pub highlight: Color,
/// Default color for entities
pub entity: Color,
/// Default color for entity outlines
pub outline: Color,
/// Color used for active construction lines
pub active: Color,
/// Color used for inactive construction lines
pub inactive: Color,
/// Color for dimensions and annotations
pub measure: Color,
/// Color for snapping indicators
pub snap_indicator: Color,
/// Color for guidelines (e.g. inference lines)
pub guide: Color,
}
impl Theme {
/// Dark theme.
pub fn dark() -> Self {
Self {
name: "default/dark".into(),
filename: None,
background: Color::rgb(0.1, 0.1, 0.1),
grid: Color::rgb(0.2, 0.2, 0.2),
selection: Color::rgb(1.0, 0.6, 0.0),
highlight: Color::rgb(1.0, 1.0, 0.0),
entity: Color::rgba(0.9, 0.9, 0.9, 0.7),
outline: Color::rgb(0.1, 0.1, 0.1),
active: Color::rgb(0.8, 0.8, 0.8),
inactive: Color::rgb(0.4, 0.4, 0.4),
measure: Color::rgb(0.0, 0.8, 0.8),
snap_indicator: Color::rgb(0.0, 1.0, 1.0),
guide: Color::rgb(0.6, 0.6, 0.6),
}
}
/// Light theme.
pub fn light() -> Self {
Self {
name: "default/light".into(),
filename: None,
background: Color::rgb(1.0, 1.0, 1.0),
grid: Color::rgb(0.85, 0.85, 0.85),
selection: Color::rgb(0.0, 0.4, 0.8),
highlight: Color::rgb(1.0, 0.6, 0.0),
entity: Color::rgba(0.7, 0.7, 0.7, 0.7),
outline: Color::rgb(0.1, 0.1, 0.1),
active: Color::rgb(0.2, 0.2, 0.2),
inactive: Color::rgb(0.8, 0.8, 0.8),
measure: Color::rgb(0.0, 0.8, 0.8),
snap_indicator: Color::rgb(0.0, 0.8, 0.8),
guide: Color::rgb(0.6, 0.6, 0.6),
}
}
}
impl Default for Theme {
fn default() -> Self {
Self::light()
}
}