1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Forward.h>
#include <AK/String.h>
#include <AK/Types.h>
#include <LibCore/AnonymousBuffer.h>
#include <LibGfx/Color.h>
namespace Gfx {
#define ENUMERATE_COLOR_ROLES(C) \
C(Accent) \
C(ActiveLink) \
C(ActiveWindowBorder1) \
C(ActiveWindowBorder2) \
C(ActiveWindowTitle) \
C(ActiveWindowTitleShadow) \
C(ActiveWindowTitleStripes) \
C(Base) \
C(BaseText) \
C(Button) \
C(ButtonText) \
C(DesktopBackground) \
C(FocusOutline) \
C(Gutter) \
C(GutterBorder) \
C(HighlightWindowBorder1) \
C(HighlightWindowBorder2) \
C(HighlightWindowTitle) \
C(HighlightWindowTitleShadow) \
C(HighlightWindowTitleStripes) \
C(HighlightSearching) \
C(HighlightSearchingText) \
C(HoverHighlight) \
C(InactiveSelection) \
C(InactiveSelectionText) \
C(InactiveWindowBorder1) \
C(InactiveWindowBorder2) \
C(InactiveWindowTitle) \
C(InactiveWindowTitleShadow) \
C(InactiveWindowTitleStripes) \
C(Link) \
C(MenuBase) \
C(MenuBaseText) \
C(MenuSelection) \
C(MenuSelectionText) \
C(MenuStripe) \
C(MovingWindowBorder1) \
C(MovingWindowBorder2) \
C(MovingWindowTitle) \
C(MovingWindowTitleShadow) \
C(MovingWindowTitleStripes) \
C(PlaceholderText) \
C(RubberBandBorder) \
C(RubberBandFill) \
C(Ruler) \
C(RulerActiveText) \
C(RulerBorder) \
C(RulerInactiveText) \
C(Selection) \
C(SelectionText) \
C(SyntaxComment) \
C(SyntaxControlKeyword) \
C(SyntaxIdentifier) \
C(SyntaxKeyword) \
C(SyntaxNumber) \
C(SyntaxOperator) \
C(SyntaxPreprocessorStatement) \
C(SyntaxPreprocessorValue) \
C(SyntaxPunctuation) \
C(SyntaxString) \
C(SyntaxType) \
C(TextCursor) \
C(ThreedHighlight) \
C(ThreedShadow1) \
C(ThreedShadow2) \
C(Tooltip) \
C(TooltipText) \
C(Tray) \
C(TrayText) \
C(VisitedLink) \
C(Window) \
C(WindowText)
enum class ColorRole {
NoRole,
#undef __ENUMERATE_COLOR_ROLE
#define __ENUMERATE_COLOR_ROLE(role) role,
ENUMERATE_COLOR_ROLES(__ENUMERATE_COLOR_ROLE)
#undef __ENUMERATE_COLOR_ROLE
__Count,
Background = Window,
DisabledText = ThreedShadow1,
};
inline const char* to_string(ColorRole role)
{
switch (role) {
case ColorRole::NoRole:
return "NoRole";
#undef __ENUMERATE_COLOR_ROLE
#define __ENUMERATE_COLOR_ROLE(role) \
case ColorRole::role: \
return #role;
ENUMERATE_COLOR_ROLES(__ENUMERATE_COLOR_ROLE)
#undef __ENUMERATE_COLOR_ROLE
default:
VERIFY_NOT_REACHED();
}
}
enum class MetricRole {
NoRole,
TitleHeight,
TitleButtonWidth,
TitleButtonHeight,
__Count,
};
enum class PathRole {
NoRole,
TitleButtonIcons,
InactiveWindowShadow,
ActiveWindowShadow,
TaskbarShadow,
MenuShadow,
TooltipShadow,
__Count,
};
struct SystemTheme {
RGBA32 color[(int)ColorRole::__Count];
int metric[(int)MetricRole::__Count];
char path[(int)PathRole::__Count][256]; // TODO: PATH_MAX?
};
Core::AnonymousBuffer& current_system_theme_buffer();
void set_system_theme(Core::AnonymousBuffer);
Core::AnonymousBuffer load_system_theme(const String& path);
}
using Gfx::ColorRole;
|