Extract most colors in codebase into theme file. switch to dark

This commit is contained in:
Max Brunsfeld
2021-07-30 09:50:28 -07:00
parent c306ac007c
commit 372d2ccb6d
10 changed files with 275 additions and 130 deletions
+9 -2
View File
@@ -20,6 +20,7 @@ pub struct Label {
family_id: FamilyId,
font_properties: Properties,
font_size: f32,
default_color: ColorU,
highlights: Option<Highlights>,
}
@@ -36,10 +37,16 @@ impl Label {
family_id,
font_properties: Properties::new(),
font_size,
default_color: ColorU::black(),
highlights: None,
}
}
pub fn with_default_color(mut self, color: ColorU) -> Self {
self.default_color = color;
self
}
pub fn with_highlights(
mut self,
color: ColorU,
@@ -69,7 +76,7 @@ impl Label {
for (char_ix, c) in self.text.char_indices() {
let mut font_id = font_id;
let mut color = ColorU::black();
let mut color = self.default_color;
if let Some(highlight_ix) = highlight_indices.peek() {
if char_ix == *highlight_ix {
font_id = highlight_font_id;
@@ -97,7 +104,7 @@ impl Label {
runs
} else {
smallvec![(self.text.len(), font_id, ColorU::black())]
smallvec![(self.text.len(), font_id, self.default_color)]
}
}
}