Skip to content

Commit 3330f6f

Browse files
committed
Do not handle None of theme fg and bg colors
1 parent b7a5e52 commit 3330f6f

File tree

1 file changed

+5
-30
lines changed

1 file changed

+5
-30
lines changed

src/assets.rs

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,6 @@ pub struct Css {
8787
pub dark: Asset,
8888
}
8989

90-
trait ColorExt {
91-
/// Construct some color from the given RGBA components.
92-
fn new(r: u8, g: u8, b: u8, a: u8) -> Self;
93-
}
94-
95-
impl ColorExt for Color {
96-
fn new(r: u8, g: u8, b: u8, a: u8) -> Self {
97-
Self { r, g, b, a }
98-
}
99-
}
100-
10190
impl Css {
10291
/// Create CSS assets for `theme`.
10392
pub fn new(theme: Theme) -> Self {
@@ -115,25 +104,11 @@ impl Css {
115104
let light_theme = light_theme(theme);
116105
let dark_theme = dark_theme(theme);
117106

118-
let light_foreground = light_theme
119-
.settings
120-
.foreground
121-
.unwrap_or(Color::new(3, 3, 3, 100));
122-
123-
let light_background = light_theme
124-
.settings
125-
.background
126-
.unwrap_or(Color::new(250, 250, 250, 100));
127-
128-
let dark_foreground = dark_theme
129-
.settings
130-
.foreground
131-
.unwrap_or(Color::new(230, 225, 207, 100));
132-
133-
let dark_background = dark_theme
134-
.settings
135-
.background
136-
.unwrap_or(Color::new(15, 20, 25, 100));
107+
// SAFETY: all supported color themes have a defined foreground and background color.
108+
let light_foreground = light_theme.settings.foreground.expect("existing color");
109+
let light_background = light_theme.settings.background.expect("existing color");
110+
let dark_foreground = dark_theme.settings.foreground.expect("existing color");
111+
let dark_background = dark_theme.settings.background.expect("existing color");
137112

138113
let light = Asset::new_hashed(
139114
"light",

0 commit comments

Comments
 (0)