mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 16:57:36 +00:00
Base+LibGUI+LibGfx: Improve disabled text readability
Currently, disabled text colors are hardcoded. They look good in Default and light themes, but no so good in dark ones. This PR adds new variables for all themes to correctly display disabled text.
This commit is contained in:
parent
26d29e9220
commit
7c32400431
22 changed files with 44 additions and 4 deletions
|
@ -226,8 +226,8 @@ void AbstractButton::paint_text(Painter& painter, const Gfx::IntRect& rect, cons
|
|||
auto clipped_rect = rect.intersected(this->rect());
|
||||
|
||||
if (!is_enabled()) {
|
||||
painter.draw_text(clipped_rect.translated(1, 1), text(), font, text_alignment, Color::White, Gfx::TextElision::Right, text_wrapping);
|
||||
painter.draw_text(clipped_rect, text(), font, text_alignment, Color::from_rgb(0x808080), Gfx::TextElision::Right, text_wrapping);
|
||||
painter.draw_text(clipped_rect.translated(1, 1), text(), font, text_alignment, palette().disabled_text_back(), Gfx::TextElision::Right, text_wrapping);
|
||||
painter.draw_text(clipped_rect, text(), font, text_alignment, palette().disabled_text_front(), Gfx::TextElision::Right, text_wrapping);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,8 +104,8 @@ void Label::paint_event(PaintEvent& event)
|
|||
if (is_enabled()) {
|
||||
painter.draw_text(text_rect, text(), text_alignment(), palette().color(foreground_role()), Gfx::TextElision::Right, text_wrapping());
|
||||
} else {
|
||||
painter.draw_text(text_rect.translated(1, 1), text(), font(), text_alignment(), Color::White, Gfx::TextElision::Right, text_wrapping());
|
||||
painter.draw_text(text_rect, text(), font(), text_alignment(), Color::from_rgb(0x808080), Gfx::TextElision::Right, text_wrapping());
|
||||
painter.draw_text(text_rect.translated(1, 1), text(), font(), text_alignment(), palette().disabled_text_back(), Gfx::TextElision::Right, text_wrapping());
|
||||
painter.draw_text(text_rect, text(), font(), text_alignment(), palette().disabled_text_front(), Gfx::TextElision::Right, text_wrapping());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -99,6 +99,8 @@ public:
|
|||
Color menu_selection_text() const { return color(ColorRole::MenuSelectionText); }
|
||||
Color base() const { return color(ColorRole::Base); }
|
||||
Color base_text() const { return color(ColorRole::BaseText); }
|
||||
Color disabled_text_front() const { return color(ColorRole::DisabledTextFront); }
|
||||
Color disabled_text_back() const { return color(ColorRole::DisabledTextBack); }
|
||||
Color button() const { return color(ColorRole::Button); }
|
||||
Color button_text() const { return color(ColorRole::ButtonText); }
|
||||
Color threed_highlight() const { return color(ColorRole::ThreedHighlight); }
|
||||
|
|
|
@ -30,6 +30,8 @@ namespace Gfx {
|
|||
C(BaseText) \
|
||||
C(Button) \
|
||||
C(ButtonText) \
|
||||
C(DisabledTextFront) \
|
||||
C(DisabledTextBack) \
|
||||
C(DesktopBackground) \
|
||||
C(FocusOutline) \
|
||||
C(Gutter) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue