summaryrefslogtreecommitdiff
path: root/Games/Minesweeper/Field.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-01-02 23:05:27 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-02 23:31:22 +0100
commit306aff80d03d25df185dee5a37b89d1af30daee4 (patch)
treec713d48ddffee8b71448985b9fb5e1a82e8a4e42 /Games/Minesweeper/Field.cpp
parentfc2c5c373bc89b7b9e0495afbce528b51dd88ca4 (diff)
downloadserenity-306aff80d03d25df185dee5a37b89d1af30daee4.zip
LibGUI: Remove Widget's unused m_{foreground,background}_color
...as well as the few remaining references to set_foreground_color(). These properties are not being used for rendering anymore, presumably because they completely mess up theming - assigning random white and gray backgrounds just doesn't work with dark themes. I've chosen to not replace most of the few remaining uses of this broken functionality with custom palette colors (the closest replacement is background_role) for now (except for Minesweeper where squares with mines are painted red again now), as no one has actually complained about them being broken, so it must look somewhat decent (some just look right anyway). :^) Examples of this are the taskbar buttons, which apparently had a DarkGray foreground color for minimized windows once - this has since been replaced with bold/regular font. Another one is the Profiler's ProfileTimelineWidget, which is supposed to have a white background - which it didn't have for quite some time, it's grey now (with the default theme, that is). Doesn't look bad either.
Diffstat (limited to 'Games/Minesweeper/Field.cpp')
-rw-r--r--Games/Minesweeper/Field.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Games/Minesweeper/Field.cpp b/Games/Minesweeper/Field.cpp
index bfe1bddd4a..75183d1963 100644
--- a/Games/Minesweeper/Field.cpp
+++ b/Games/Minesweeper/Field.cpp
@@ -252,7 +252,11 @@ void Field::reset()
square.is_swept = false;
if (!square.label) {
square.label = add<SquareLabel>(square);
- square.label->set_background_color(Color::from_rgb(0xff4040));
+ // Square with mine will be filled with background color later, i.e. red
+ auto palette = square.label->palette();
+ palette.set_color(Gfx::ColorRole::Base, Color::from_rgb(0xff4040));
+ square.label->set_palette(palette);
+ square.label->set_background_role(Gfx::ColorRole::Base);
}
square.label->set_fill_with_background_color(false);
square.label->set_relative_rect(rect);