@@ -196,14 +196,18 @@ pub struct Visuals {
196
196
197
197
pub selection : Selection ,
198
198
199
+ /// The color used for `Hyperlink`,
200
+ pub hyperlink_color : Color32 ,
201
+
202
+ /// Something just barely different from the background color.
203
+ /// Used for [`Grid::striped`].
204
+ pub faint_bg_color : Color32 ,
205
+
199
206
/// Very dark or light color (for corresponding theme).
200
207
/// Used as the background of text edits, scroll bars and others things
201
208
/// that needs to look different from other interactive stuff.
202
209
pub extreme_bg_color : Color32 ,
203
210
204
- /// The color used for `Hyperlink`,
205
- pub hyperlink_color : Color32 ,
206
-
207
211
/// Background color behind code-styled monospaced labels.
208
212
pub code_bg_color : Color32 ,
209
213
@@ -392,8 +396,9 @@ impl Visuals {
392
396
override_text_color : None ,
393
397
widgets : Widgets :: default ( ) ,
394
398
selection : Selection :: default ( ) ,
395
- extreme_bg_color : Color32 :: from_gray ( 10 ) ,
396
399
hyperlink_color : Color32 :: from_rgb ( 90 , 170 , 255 ) ,
400
+ faint_bg_color : Color32 :: from_gray ( 24 ) ,
401
+ extreme_bg_color : Color32 :: from_gray ( 10 ) ,
397
402
code_bg_color : Color32 :: from_gray ( 64 ) ,
398
403
window_corner_radius : 6.0 ,
399
404
window_shadow : Shadow :: big_dark ( ) ,
@@ -412,8 +417,9 @@ impl Visuals {
412
417
dark_mode : false ,
413
418
widgets : Widgets :: light ( ) ,
414
419
selection : Selection :: light ( ) ,
415
- extreme_bg_color : Color32 :: from_gray ( 235 ) , // TODO: rename
416
- hyperlink_color : Color32 :: from_rgb ( 0 , 133 , 218 ) ,
420
+ hyperlink_color : Color32 :: from_rgb ( 0 , 155 , 255 ) ,
421
+ faint_bg_color : Color32 :: from_gray ( 240 ) ,
422
+ extreme_bg_color : Color32 :: from_gray ( 250 ) ,
417
423
code_bg_color : Color32 :: from_gray ( 200 ) ,
418
424
window_shadow : Shadow :: big_light ( ) ,
419
425
..Self :: dark ( )
@@ -506,7 +512,7 @@ impl Widgets {
506
512
expansion : 0.0 ,
507
513
} ,
508
514
hovered : WidgetVisuals {
509
- bg_fill : Color32 :: from_gray ( 190 ) ,
515
+ bg_fill : Color32 :: from_gray ( 210 ) ,
510
516
bg_stroke : Stroke :: new ( 1.0 , Color32 :: from_gray ( 105 ) ) , // e.g. hover over window edge or button
511
517
fg_stroke : Stroke :: new ( 1.5 , Color32 :: BLACK ) ,
512
518
corner_radius : 3.0 ,
@@ -740,7 +746,7 @@ impl Widgets {
740
746
open. ui ( ui)
741
747
} ) ;
742
748
743
- ui. vertical_centered ( |ui| reset_button ( ui, self ) ) ;
749
+ // ui.vertical_centered(|ui| reset_button(ui, self));
744
750
}
745
751
}
746
752
@@ -812,8 +818,9 @@ impl Visuals {
812
818
override_text_color : _,
813
819
widgets,
814
820
selection,
815
- extreme_bg_color,
816
821
hyperlink_color,
822
+ faint_bg_color,
823
+ extreme_bg_color,
817
824
code_bg_color,
818
825
window_corner_radius,
819
826
window_shadow,
@@ -825,6 +832,16 @@ impl Visuals {
825
832
collapsing_header_frame,
826
833
} = self ;
827
834
835
+ ui. collapsing ( "Background Colors" , |ui| {
836
+ ui_color ( ui, & mut widgets. inactive . bg_fill , "Buttons" ) ;
837
+ ui_color ( ui, & mut widgets. noninteractive . bg_fill , "Windows" ) ;
838
+ ui_color ( ui, faint_bg_color, "Faint accent" ) . on_hover_text (
839
+ "Used for faint accentuation of interactive things, like striped grids." ,
840
+ ) ;
841
+ ui_color ( ui, extreme_bg_color, "Extreme" )
842
+ . on_hover_text ( "Background of plots and paintings" ) ;
843
+ } ) ;
844
+
828
845
ui. collapsing ( "Window" , |ui| {
829
846
// Common shortcuts
830
847
ui_color ( ui, & mut widgets. noninteractive . bg_fill , "Fill" ) ;
@@ -841,13 +858,19 @@ impl Visuals {
841
858
& mut widgets. noninteractive . fg_stroke . color ,
842
859
"Text color" ,
843
860
) ;
861
+ ui_color ( ui, code_bg_color, Label :: new ( "Code background" ) . code ( ) ) . on_hover_ui ( |ui| {
862
+ ui. horizontal ( |ui| {
863
+ ui. spacing_mut ( ) . item_spacing . x = 0.0 ;
864
+ ui. label ( "For monospaced inlined text " ) ;
865
+ ui. code ( "like this" ) ;
866
+ ui. label ( "." ) ;
867
+ } ) ;
868
+ } ) ;
844
869
845
- ui_color ( ui, extreme_bg_color, "extreme_bg_color" ) ;
846
870
ui_color ( ui, hyperlink_color, "hyperlink_color" ) ;
847
- ui_color ( ui, code_bg_color, "code_bg_color" ) ;
848
871
ui. add ( Slider :: new ( resize_corner_size, 0.0 ..=20.0 ) . text ( "resize_corner_size" ) ) ;
849
- ui. add ( Slider :: new ( text_cursor_width, 0.0 ..=2 .0) . text ( "text_cursor_width" ) ) ;
850
- ui. checkbox ( text_cursor_preview, "text_cursor_preview " ) ;
872
+ ui. add ( Slider :: new ( text_cursor_width, 0.0 ..=4 .0) . text ( "text_cursor_width" ) ) ;
873
+ ui. checkbox ( text_cursor_preview, "Preview text cursor on hover " ) ;
851
874
ui. add ( Slider :: new ( clip_rect_margin, 0.0 ..=20.0 ) . text ( "clip_rect_margin" ) ) ;
852
875
853
876
ui. checkbox ( button_frame, "Button has a frame" ) ;
@@ -905,9 +928,10 @@ fn slider_vec2<'a>(
905
928
}
906
929
}
907
930
908
- fn ui_color ( ui : & mut Ui , srgba : & mut Color32 , text : & str ) {
931
+ fn ui_color ( ui : & mut Ui , srgba : & mut Color32 , text : impl Into < Label > ) -> Response {
909
932
ui. horizontal ( |ui| {
910
933
ui. color_edit_button_srgba ( srgba) ;
911
934
ui. label ( text) ;
912
- } ) ;
935
+ } )
936
+ . response
913
937
}
0 commit comments