Skip to content

Commit a2c24c1

Browse files
committed
Merge pull request #112296 from passivestar/scrollbar-fix
Fix 2D viewport scrollbar contrast in modern theme
2 parents 5519dba + 91e8072 commit a2c24c1

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

editor/themes/theme_modern.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,16 +1029,12 @@ void ThemeModern::populate_standard_styles(const Ref<EditorTheme> &p_theme, Edit
10291029
Ref<Texture2D> empty_icon = memnew(ImageTexture);
10301030

10311031
Ref<StyleBoxFlat> grabber_style = p_config.base_style->duplicate();
1032-
grabber_style->set_bg_color(_get_base_color(p_config, 0.5, 0.6));
1033-
grabber_style->set_border_color(p_config.base_color * Color(1, 1, 1, 0));
1034-
grabber_style->set_border_width_all(3 * EDSCALE);
1032+
grabber_style->set_bg_color(p_config.mono_color * Color(1, 1, 1, 0.225));
10351033

10361034
Ref<StyleBoxFlat> grabber_hl_style = p_config.base_style->duplicate();
1037-
grabber_hl_style->set_bg_color(_get_base_color(p_config, 1.4, 0.5));
1038-
grabber_hl_style->set_border_color(_get_base_color(p_config) * Color(1, 1, 1, 0));
1039-
grabber_hl_style->set_border_width_all(2.5 * EDSCALE);
1035+
grabber_hl_style->set_bg_color(p_config.mono_color * Color(1, 1, 1, 0.5));
10401036

1041-
int scroll_margin = (p_config.enable_touch_optimizations ? 12 : 6) * EDSCALE;
1037+
int scroll_margin = (p_config.enable_touch_optimizations ? 10 : 3) * EDSCALE;
10421038

10431039
// HScrollBar.
10441040

@@ -1058,6 +1054,9 @@ void ThemeModern::populate_standard_styles(const Ref<EditorTheme> &p_theme, Edit
10581054
p_theme->set_icon("decrement_highlight", "HScrollBar", empty_icon);
10591055
p_theme->set_icon("decrement_pressed", "HScrollBar", empty_icon);
10601056

1057+
p_theme->set_constant("padding_top", "HScrollBar", p_config.base_margin * EDSCALE);
1058+
p_theme->set_constant("padding_bottom", "HScrollBar", p_config.base_margin * EDSCALE);
1059+
10611060
// VScrollBar.
10621061

10631062
Ref<StyleBoxEmpty> v_scroll_style = p_config.base_empty_style->duplicate();
@@ -1076,6 +1075,9 @@ void ThemeModern::populate_standard_styles(const Ref<EditorTheme> &p_theme, Edit
10761075
p_theme->set_icon("decrement_highlight", "VScrollBar", empty_icon);
10771076
p_theme->set_icon("decrement_pressed", "VScrollBar", empty_icon);
10781077

1078+
p_theme->set_constant("padding_left", "VScrollBar", p_config.base_margin * EDSCALE);
1079+
p_theme->set_constant("padding_right", "VScrollBar", p_config.base_margin * EDSCALE);
1080+
10791081
// Slider
10801082
const int background_margin = MAX(2, p_config.base_margin / 2);
10811083

0 commit comments

Comments
 (0)