1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

Themes: Support rubberband selection theming

This commit is contained in:
0xtechnobabble 2020-01-06 01:47:55 +02:00 committed by Andreas Kling
parent 56a2c21e0c
commit 123dcada05
9 changed files with 22 additions and 7 deletions

View file

@ -32,17 +32,17 @@ RefPtr<SharedBuffer> load_system_theme(const String& path)
auto* data = (SystemTheme*)buffer->data();
auto get = [&](auto& name) {
auto get_color = [&](auto& name) {
auto color_string = file->read_entry("Colors", name);
auto color = Color::from_string(color_string);
if (!color.has_value())
return Color(Color::Black);
dbg() << "Parsed system color '" << name << "' = " << color.value();
dbg() << "Parsed system theme color '" << name << "' = " << color.value();
return color.value();
};
#define DO_COLOR(x) \
data->color[(int)ColorRole::x] = get(#x)
data->color[(int)ColorRole::x] = get_color(#x)
DO_COLOR(DesktopBackground);
DO_COLOR(ThreedHighlight);
@ -75,6 +75,8 @@ RefPtr<SharedBuffer> load_system_theme(const String& path)
DO_COLOR(MenuBaseText);
DO_COLOR(MenuSelection);
DO_COLOR(MenuSelectionText);
DO_COLOR(RubberBandFill);
DO_COLOR(RubberBandBorder);
buffer->seal();
buffer->share_globally();