mirror of
https://github.com/RGBCube/serenity
synced 2025-05-23 15:45:06 +00:00
Themes: Fix default theme window stripes and shadow after #2811
Change #2811 made window title stripes and window title shadow themable, but it used the same stripe and shadow color for all window modes. This is fine for the new 'basalt' theme which uses the same color in all four window modes, but it changed the default theme so that background windows had brown stripes and a brown shadow. Instead, make the title stripe and title shadow themable per window mode, and change the default theme to restore the colors it had before change #2811: The title stripe color is the same as Border1 for all window modes, and the title shadow is the same as the title stripe darkened by 0.6.
This commit is contained in:
parent
d366ad8232
commit
6dd10ad8dc
7 changed files with 50 additions and 18 deletions
|
@ -170,12 +170,12 @@ WindowFrame::FrameColors WindowFrame::compute_frame_colors() const
|
|||
auto& wm = WindowManager::the();
|
||||
auto palette = wm.palette();
|
||||
if (&m_window == wm.m_highlight_window)
|
||||
return { palette.highlight_window_title(), palette.highlight_window_border1(), palette.highlight_window_border2() };
|
||||
return { palette.highlight_window_title(), palette.highlight_window_border1(), palette.highlight_window_border2(), palette.highlight_window_title_stripes(), palette.highlight_window_title_shadow() };
|
||||
if (&m_window == wm.m_move_window)
|
||||
return { palette.moving_window_title(), palette.moving_window_border1(), palette.moving_window_border2() };
|
||||
return { palette.moving_window_title(), palette.moving_window_border1(), palette.moving_window_border2(), palette.moving_window_title_stripes(), palette.moving_window_title_shadow() };
|
||||
if (wm.is_active_window_or_accessory(m_window))
|
||||
return { palette.active_window_title(), palette.active_window_border1(), palette.active_window_border2() };
|
||||
return { palette.inactive_window_title(), palette.inactive_window_border1(), palette.inactive_window_border2() };
|
||||
return { palette.active_window_title(), palette.active_window_border1(), palette.active_window_border2(), palette.active_window_title_stripes(), palette.active_window_title_shadow() };
|
||||
return { palette.inactive_window_title(), palette.inactive_window_border1(), palette.inactive_window_border2(), palette.inactive_window_title_stripes(), palette.inactive_window_title_shadow() };
|
||||
}
|
||||
|
||||
void WindowFrame::paint_notification_frame(Gfx::Painter& painter)
|
||||
|
@ -192,7 +192,7 @@ void WindowFrame::paint_notification_frame(Gfx::Painter& painter)
|
|||
int stripe_bottom = m_window.height() - 3;
|
||||
if (stripe_top && stripe_bottom && stripe_top < stripe_bottom) {
|
||||
for (int i = 2; i <= palette.window_title_height() - 2; i += 2) {
|
||||
painter.draw_line({ titlebar_rect.x() + i, stripe_top }, { titlebar_rect.x() + i, stripe_bottom }, palette.window_title_stripes());
|
||||
painter.draw_line({ titlebar_rect.x() + i, stripe_top }, { titlebar_rect.x() + i, stripe_bottom }, palette.active_window_title_stripes());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ void WindowFrame::paint_normal_frame(Gfx::Painter& painter)
|
|||
auto titlebar_title_rect = titlebar_inner_rect;
|
||||
titlebar_title_rect.set_width(WindowManager::the().window_title_font().width(title_text));
|
||||
|
||||
auto [title_color, border_color, border_color2] = compute_frame_colors();
|
||||
auto [title_color, border_color, border_color2, stripes_color, shadow_color] = compute_frame_colors();
|
||||
|
||||
auto& wm = WindowManager::the();
|
||||
painter.draw_line(titlebar_rect.bottom_left().translated(0, 1), titlebar_rect.bottom_right().translated(0, 1), palette.button());
|
||||
|
@ -234,14 +234,14 @@ void WindowFrame::paint_normal_frame(Gfx::Painter& painter)
|
|||
int stripe_right = leftmost_button_rect.left() - 3;
|
||||
if (stripe_left && stripe_right && stripe_left < stripe_right) {
|
||||
for (int i = 2; i <= titlebar_inner_rect.height() - 2; i += 2) {
|
||||
painter.draw_line({ stripe_left, titlebar_inner_rect.y() + i }, { stripe_right, titlebar_inner_rect.y() + i }, palette.window_title_stripes());
|
||||
painter.draw_line({ stripe_left, titlebar_inner_rect.y() + i }, { stripe_right, titlebar_inner_rect.y() + i }, stripes_color);
|
||||
}
|
||||
}
|
||||
|
||||
auto clipped_title_rect = titlebar_title_rect;
|
||||
clipped_title_rect.set_width(stripe_right - clipped_title_rect.x());
|
||||
if (!clipped_title_rect.is_empty()) {
|
||||
painter.draw_text(clipped_title_rect.translated(1, 2), title_text, wm.window_title_font(), Gfx::TextAlignment::CenterLeft, palette.window_title_shadow(), Gfx::TextElision::Right);
|
||||
painter.draw_text(clipped_title_rect.translated(1, 2), title_text, wm.window_title_font(), Gfx::TextAlignment::CenterLeft, shadow_color, Gfx::TextElision::Right);
|
||||
// FIXME: The translated(0, 1) wouldn't be necessary if we could center text based on its baseline.
|
||||
painter.draw_text(clipped_title_rect.translated(0, 1), title_text, wm.window_title_font(), Gfx::TextAlignment::CenterLeft, title_color, Gfx::TextElision::Right);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue