mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:57:44 +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:
parent
2eaed880b1
commit
4f42e4ba90
4 changed files with 48 additions and 0 deletions
|
@ -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
|
||||
*/
|
||||
|
@ -56,6 +57,14 @@ void Palette::set_color(ColorRole role, Color color)
|
|||
theme.color[(int)role] = color.value();
|
||||
}
|
||||
|
||||
void Palette::set_flag(FlagRole role, bool value)
|
||||
{
|
||||
if (m_impl->ref_count() != 1)
|
||||
m_impl = m_impl->clone();
|
||||
auto& theme = const_cast<SystemTheme&>(impl().theme());
|
||||
theme.flag[(int)role] = value;
|
||||
}
|
||||
|
||||
void Palette::set_metric(MetricRole role, int value)
|
||||
{
|
||||
if (m_impl->ref_count() != 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue