UI: Increase Contrast of Scroll Bar Thumb for Light Themes

Since 115d809358 the scroll bars are darker on light theme. But this
makes the circular "handles", in Timeline for example, to not be
visible. This is because we start with the item color and then make
it darker when over a threshold. But we never make them lighter when
they are dark. This PR makes these darker or lighter depending on the
base color.

Pull Request: https://projects.blender.org/blender/blender/pulls/137618
This commit is contained in:
Harley Acheson
2025-04-17 01:29:06 +02:00
committed by Harley Acheson
parent b52554b475
commit 101d8782f7

View File

@@ -3637,16 +3637,19 @@ void UI_draw_widget_scroll(uiWidgetColors *wcol, const rcti *rect, const rcti *s
round_box_edges(&wtb, UI_CNR_ALL, slider, rad);
if (state & UI_SCROLL_ARROWS) {
if (wcol->item[0] > 48) {
wcol->item[0] -= 48;
const uchar lightness = srgb_to_grayscale_byte(wcol->item);
if (lightness > 70) {
wcol->item[0] = 0;
wcol->item[1] = 0;
wcol->item[2] = 0;
wcol->item[3] = 128;
}
if (wcol->item[1] > 48) {
wcol->item[1] -= 48;
else {
wcol->item[0] = 255;
wcol->item[1] = 255;
wcol->item[2] = 255;
wcol->item[3] = 128;
}
if (wcol->item[2] > 48) {
wcol->item[2] -= 48;
}
wcol->item[3] = 255;
if (horizontal) {
rcti slider_inset = *slider;