1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:27:45 +00:00

LibGfx: Add 'IsDark' flag to SystemTheme and Palette

This explicitly states whether a given theme is a dark theme, so that
applications not using the system palette colors can still attempt to
match the overall theme.
This commit is contained in:
Sam Atkins 2021-10-26 14:30:52 +01:00 committed by Linus Groh
parent 2eaed880b1
commit 4f42e4ba90
4 changed files with 48 additions and 0 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -89,6 +90,9 @@ namespace Gfx {
C(Window) \
C(WindowText)
#define ENUMERATE_FLAG_ROLES(C) \
C(IsDark)
#define ENUMERATE_METRIC_ROLES(C) \
C(TitleHeight) \
C(TitleButtonWidth) \
@ -132,6 +136,17 @@ inline const char* to_string(ColorRole role)
}
}
enum class FlagRole {
NoRole,
#undef __ENUMERATE_FLAG_ROLE
#define __ENUMERATE_FLAG_ROLE(role) role,
ENUMERATE_FLAG_ROLES(__ENUMERATE_FLAG_ROLE)
#undef __ENUMERATE_FLAG_ROLE
__Count,
};
enum class MetricRole {
NoRole,
@ -188,6 +203,7 @@ inline const char* to_string(PathRole role)
struct SystemTheme {
RGBA32 color[(int)ColorRole::__Count];
bool flag[(int)FlagRole::__Count];
int metric[(int)MetricRole::__Count];
char path[(int)PathRole::__Count][256]; // TODO: PATH_MAX?
};