mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-15 12:15:59 +00:00
LibGUI+LibDraw: Add "Palette" concept for scoped color theming
GApplication now has a palette. This palette contains all the system theme colors by default, and is inherited by a new top-level GWidget. New child widgets inherit their parents palette. It is possible to override the GApplication palette, and the palette of any GWidget. The Palette object contains a bunch of colors, each corresponding to a ColorRole. Each role has a convenience getter as well. Each GWidget now has a background_role() and foreground_role(), which are then looked up in their current palette when painting. This means that you no longer alter the background color of a widget by setting it directly, rather you alter either its background role, or the widget's palette.
This commit is contained in:
@@ -68,7 +68,7 @@ void Editor::paint_event(GPaintEvent& event)
|
||||
rect.set_width(rect.width() - vertical_scrollbar().width());
|
||||
if (horizontal_scrollbar().is_visible())
|
||||
rect.set_height(rect.height() - horizontal_scrollbar().height());
|
||||
painter.draw_rect(rect, SystemColor::Selection);
|
||||
painter.draw_rect(rect, palette().selection());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user