fix: button bevel colors derived from titlebar background
Hardcoded white/dark bevel looked wrong against colored titlebars. Derive highlight and shadow colors from the actual titlebar background color (+33% for highlight, -33% for shadow) to match the titlebar bevel style.
This commit is contained in:
parent
5a4d989a78
commit
f3cb593d0f
|
|
@ -7636,9 +7636,16 @@ static void wl_frame_paint_button(WCoreWindow *button, WTexture *texture,
|
|||
for (int x = 0; x < bw; x++)
|
||||
dst[y * dst_stride + x] = fill_bg;
|
||||
|
||||
/* Draw border bevel (raised when normal, sunken when pushed) */
|
||||
uint32_t hi = pushed ? 0xFF222222 : 0xFFDDDDDD;
|
||||
uint32_t lo = pushed ? 0xFFDDDDDD : 0xFF222222;
|
||||
/* Draw border bevel derived from bg color (raised normal, sunken pushed) */
|
||||
unsigned char bg_r = (bg_pixel >> 16) & 0xFF;
|
||||
unsigned char bg_g = (bg_pixel >> 8) & 0xFF;
|
||||
unsigned char bg_b = bg_pixel & 0xFF;
|
||||
uint32_t hi_c = 0xFF000000 | ((uint32_t)(bg_r + (255-bg_r)/3) << 16) |
|
||||
((uint32_t)(bg_g + (255-bg_g)/3) << 8) | (bg_b + (255-bg_b)/3);
|
||||
uint32_t lo_c = 0xFF000000 | ((uint32_t)(bg_r * 2/3) << 16) |
|
||||
((uint32_t)(bg_g * 2/3) << 8) | (bg_b * 2/3);
|
||||
uint32_t hi = pushed ? lo_c : hi_c;
|
||||
uint32_t lo = pushed ? hi_c : lo_c;
|
||||
for (int x = 0; x < bw; x++) { dst[x] = hi; dst[(bh-1) * dst_stride + x] = lo; }
|
||||
for (int y = 0; y < bh; y++) { dst[y * dst_stride] = hi; dst[y * dst_stride + bw - 1] = lo; }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue