mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
osd-thumbnail: update default colors of selected window item
Some checks failed
labwc.github.io / notify (push) Has been cancelled
Some checks failed
labwc.github.io / notify (push) Has been cancelled
Previously, the default values of
`osd.window-switcher.style-thumbnail.item.active.{bg,border}.color`
were blue. But they caused the selected window title in the window
switcher to be unreadable due to duplicated colors of the text and
background with Openbox themes like Numix.
Instead, this commit updates them to follow other themes configurations.
The default border color of the selected window item is now
`osd.label.text.color` with 50% opacity and the background is
`osd.label.text.color` with 15% opacity.
For subpixel antialiasing to work, the background color is calculated by
manually blending `osd.label.text.color` and `osd.bg.color`, rather than
just updating the alpha with 50% or 15%.
This commit is contained in:
parent
bed0be8a88
commit
998ff9e7b5
3 changed files with 41 additions and 6 deletions
37
src/theme.c
37
src/theme.c
|
|
@ -613,8 +613,8 @@ theme_builtin(struct theme *theme, struct server *server)
|
|||
theme->osd_window_switcher_thumbnail.item_height = 250;
|
||||
theme->osd_window_switcher_thumbnail.item_padding = 10;
|
||||
theme->osd_window_switcher_thumbnail.item_active_border_width = 2;
|
||||
parse_color("#589bda", theme->osd_window_switcher_thumbnail.item_active_border_color);
|
||||
parse_color("#c7e2fc", theme->osd_window_switcher_thumbnail.item_active_bg_color);
|
||||
theme->osd_window_switcher_thumbnail.item_active_border_color[0] = FLT_MIN;
|
||||
theme->osd_window_switcher_thumbnail.item_active_bg_color[0] = FLT_MIN;
|
||||
theme->osd_window_switcher_thumbnail.item_icon_size = 60;
|
||||
|
||||
/* inherit settings in post_processing() if not set elsewhere */
|
||||
|
|
@ -1633,6 +1633,31 @@ get_titlebar_height(struct theme *theme)
|
|||
return h;
|
||||
}
|
||||
|
||||
/* Blend foreground color (with new alpha) with background color */
|
||||
static void
|
||||
blend_color_with_bg(float *dst, float *fg, float fg_a, float *bg)
|
||||
{
|
||||
/* Guard against zero division */
|
||||
if (fg[3] <= 0.0f) {
|
||||
memset(dst, 0, sizeof(float) * 4);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Redo premultiplication to update foreground alpha */
|
||||
float new_fg[4] = {
|
||||
fg[0] / fg[3] * fg_a,
|
||||
fg[1] / fg[3] * fg_a,
|
||||
fg[2] / fg[3] * fg_a,
|
||||
fg_a,
|
||||
};
|
||||
|
||||
/* Blend colors */
|
||||
dst[0] = new_fg[0] + bg[0] * (1.0f - new_fg[3]);
|
||||
dst[1] = new_fg[1] + bg[1] * (1.0f - new_fg[3]);
|
||||
dst[2] = new_fg[2] + bg[2] * (1.0f - new_fg[3]);
|
||||
dst[3] = new_fg[3] + bg[3] * (1.0f - new_fg[3]);
|
||||
}
|
||||
|
||||
static void
|
||||
post_processing(struct theme *theme)
|
||||
{
|
||||
|
|
@ -1721,6 +1746,14 @@ post_processing(struct theme *theme)
|
|||
memcpy(theme->osd_border_color, theme->osd_label_text_color,
|
||||
sizeof(theme->osd_border_color));
|
||||
}
|
||||
if (switcher_thumb_theme->item_active_border_color[0] == FLT_MIN) {
|
||||
blend_color_with_bg(switcher_thumb_theme->item_active_border_color,
|
||||
theme->osd_label_text_color, 0.50, theme->osd_bg_color);
|
||||
}
|
||||
if (switcher_thumb_theme->item_active_bg_color[0] == FLT_MIN) {
|
||||
blend_color_with_bg(switcher_thumb_theme->item_active_bg_color,
|
||||
theme->osd_label_text_color, 0.15, theme->osd_bg_color);
|
||||
}
|
||||
if (theme->osd_workspace_switcher_boxes_width == 0) {
|
||||
theme->osd_workspace_switcher_boxes_height = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue