@@ -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-
10190impl 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