@@ -17,11 +17,9 @@ use crate::gui::styles::text::TextType;
1717use crate :: gui:: styles:: types:: custom_palette:: ExtraStyles ;
1818use crate :: gui:: styles:: types:: gradient_type:: GradientType ;
1919use crate :: gui:: styles:: types:: palette:: Palette ;
20+ use crate :: gui:: styles:: types:: palette_extension:: PaletteExtension ;
2021use crate :: gui:: types:: message:: Message ;
21- use crate :: translations:: translations:: {
22- appearance_title_translation, deep_sea_translation, mon_amour_translation,
23- yeti_day_translation, yeti_night_translation,
24- } ;
22+ use crate :: translations:: translations:: appearance_title_translation;
2523use crate :: translations:: translations_2:: color_gradients_translation;
2624use crate :: translations:: translations_3:: custom_style_translation;
2725use crate :: utils:: formatted_strings:: get_path_termination_string;
@@ -37,11 +35,11 @@ pub fn settings_style_page(sniffer: &Sniffer) -> Container<Message, StyleType> {
3735 style_path,
3836 ..
3937 } = sniffer. configs . lock ( ) . unwrap ( ) . settings . clone ( ) ;
40- let font = style. get_extension ( ) . font ;
41- let font_headers = style. get_extension ( ) . font_headers ;
38+ let PaletteExtension {
39+ font, font_headers, ..
40+ } = style. get_extension ( ) ;
4241
4342 let mut content = Column :: new ( )
44- . padding ( Padding :: ZERO . bottom ( 5 ) )
4543 . align_x ( Alignment :: Center )
4644 . width ( Length :: Fill )
4745 . push ( settings_header (
@@ -67,38 +65,26 @@ pub fn settings_style_page(sniffer: &Sniffer) -> Container<Message, StyleType> {
6765 . width ( Length :: Fill )
6866 . push (
6967 Row :: new ( )
70- . push ( get_palette_container (
71- style,
72- "Yeti Night" . to_string ( ) ,
73- yeti_night_translation ( language) . to_string ( ) ,
74- Night ,
75- ) )
76- . push ( Space :: with_width ( 10 ) )
77- . push ( get_palette_container (
78- style,
79- "Yeti Day" . to_string ( ) ,
80- yeti_day_translation ( language) . to_string ( ) ,
81- Day ,
82- ) ) ,
68+ . push ( get_palette_container ( style, "Yeti" . to_string ( ) , Night ) )
69+ . push ( Space :: with_width ( 15 ) )
70+ . push ( get_palette_container ( style, "Yeti" . to_string ( ) , Day ) ) ,
8371 )
84- . push ( Space :: with_height ( 10 ) )
72+ . push ( Space :: with_height ( 15 ) )
8573 . push (
8674 Row :: new ( )
8775 . push ( get_palette_container (
8876 style,
8977 "Deep Sea" . to_string ( ) ,
90- deep_sea_translation ( language) . to_string ( ) ,
9178 DeepSea ,
9279 ) )
93- . push ( Space :: with_width ( 10 ) )
80+ . push ( Space :: with_width ( 15 ) )
9481 . push ( get_palette_container (
9582 style,
9683 "Mon Amour" . to_string ( ) ,
97- mon_amour_translation ( language) . to_string ( ) ,
9884 MonAmour ,
9985 ) ) ,
10086 )
101- . push ( Space :: with_height ( 10 ) ) ;
87+ . push ( Space :: with_height ( 15 ) ) ;
10288 for children in get_extra_palettes ( ExtraStyles :: all_styles ( ) , style) {
10389 styles_col = styles_col. push ( children) ;
10490 }
@@ -108,8 +94,10 @@ pub fn settings_style_page(sniffer: &Sniffer) -> Container<Message, StyleType> {
10894 } ) )
10995 . push ( Space :: with_height ( 10 ) ) ;
11096
111- let styles_scroll =
112- Scrollable :: with_direction ( styles_col, Direction :: Vertical ( ScrollbarType :: properties ( ) ) ) ;
97+ let styles_scroll = Scrollable :: with_direction (
98+ styles_col,
99+ Direction :: Vertical ( ScrollbarType :: properties ( ) . margin ( 10 ) ) ,
100+ ) ;
113101
114102 content = content. push ( styles_scroll) ;
115103
@@ -184,32 +172,35 @@ fn gradients_row<'a>(
184172fn get_palette_container < ' a > (
185173 style : StyleType ,
186174 name : String ,
187- description : String ,
188175 on_press : StyleType ,
189176) -> Button < ' a , Message , StyleType > {
190177 let font = style. get_extension ( ) . font ;
178+ let PaletteExtension {
179+ buttons_color,
180+ is_nightly,
181+ ..
182+ } = on_press. get_extension ( ) ;
191183
192- let is_custom = matches ! ( on_press, StyleType :: Custom ( _) ) ;
184+ let caption = Row :: new ( )
185+ . spacing ( 7 )
186+ . push ( Text :: new ( name) . font ( font) )
187+ . push ( if is_nightly {
188+ Icon :: Moon . to_text ( ) . size ( 15 )
189+ } else {
190+ Icon :: Sun . to_text ( )
191+ } ) ;
193192
194- let mut content = Column :: new ( )
193+ let content = Column :: new ( )
195194 . width ( Length :: Fill )
196195 . align_x ( Alignment :: Center )
197196 . spacing ( 5 )
198- . push ( Text :: new ( name) . font ( font) )
199- . push ( get_palette_rule (
200- on_press. get_palette ( ) ,
201- on_press. get_extension ( ) . buttons_color ,
202- is_custom,
203- ) ) ;
204-
205- if !is_custom {
206- content = content. push ( Text :: new ( description) . font ( font) ) ;
207- }
197+ . push ( caption)
198+ . push ( get_palette_rule ( on_press. get_palette ( ) , buttons_color) ) ;
208199
209200 Button :: new ( content)
210- . height ( if is_custom { 75 } else { 110 } )
211- . width ( 380 )
212- . padding ( 5 )
201+ . height ( 80 )
202+ . width ( 350 )
203+ . padding ( Padding :: ZERO . top ( 10 ) )
213204 . class ( if on_press. eq ( & style) {
214205 ButtonType :: BorderedRoundSelected
215206 } else {
@@ -221,9 +212,8 @@ fn get_palette_container<'a>(
221212fn get_palette_rule < ' a > (
222213 palette : Palette ,
223214 buttons_color : Color ,
224- is_custom : bool ,
225215) -> Container < ' a , Message , StyleType > {
226- let height = if is_custom { 25 } else { 40 } ;
216+ let height = 25 ;
227217
228218 Container :: new (
229219 Row :: new ( )
@@ -255,9 +245,8 @@ fn get_extra_palettes<'a>(
255245 // Map each extra style into a palette container
256246 let mut styles = styles. iter ( ) . map ( |& style| {
257247 let name = style. to_string ( ) ;
258- let description = String :: new ( ) ;
259248 let style = StyleType :: Custom ( style) ;
260- get_palette_container ( current_style, name, description , style)
249+ get_palette_container ( current_style, name, style)
261250 } ) ;
262251
263252 // The best way to do this would be with itertools, but that would introduce another dependency.
@@ -272,15 +261,15 @@ fn get_extra_palettes<'a>(
272261 children. extend ( [
273262 Row :: new ( )
274263 . push ( first)
275- . push ( Space :: with_width ( 10 ) )
264+ . push ( Space :: with_width ( 15 ) )
276265 . push ( second)
277266 . into ( ) ,
278- <Space as Into < Element < Message , StyleType > > >:: into ( Space :: with_height ( 10 ) ) ,
267+ <Space as Into < Element < Message , StyleType > > >:: into ( Space :: with_height ( 15 ) ) ,
279268 ] ) ;
280269 } else {
281270 children. extend ( [
282271 Row :: new ( ) . push ( first) . into ( ) ,
283- <Space as Into < Element < Message , StyleType > > >:: into ( Space :: with_height ( 10 ) ) ,
272+ <Space as Into < Element < Message , StyleType > > >:: into ( Space :: with_height ( 15 ) ) ,
284273 ] ) ;
285274 }
286275 }
@@ -334,14 +323,9 @@ fn lazy_custom_style_input<'a>(
334323 content = content. push ( get_palette_rule (
335324 style. get_palette ( ) ,
336325 style. get_extension ( ) . buttons_color ,
337- true ,
338326 ) ) ;
339327 } else if let Ok ( palette) = custom_palette {
340- content = content. push ( get_palette_rule (
341- palette,
342- palette. generate_buttons_color ( ) ,
343- true ,
344- ) ) ;
328+ content = content. push ( get_palette_rule ( palette, palette. generate_buttons_color ( ) ) ) ;
345329 }
346330
347331 Button :: new ( content)
0 commit comments