3#include <QtQml/QQmlEngine>
6#include "qml_material/core.hpp"
7#include "qml_material/core/enum.hpp"
8#include "qml_material/core/helper.hpp"
37 Q_PROPERTY(qml_material::Enum::PaletteType paletteType READ paletteType WRITE setPaletteType
38 NOTIFY paletteTypeChanged FINAL)
52 useSysColorSMChanged FINAL)
59 useSysAccentColorChanged FINAL)
62 Q_PROPERTY(QColor _n_ READ _n_ NOTIFY schemeChanged) \
63 QColor _n_() const { return m_scheme._n_; }
174 Q_INVOKABLE QColor get_##_n_(double tone) const { return m_scheme._n_##_palette.get(tone); }
179#define X(_n_, _tone_) \
180 Q_PROPERTY(QColor _n_##_##_tone_ READ _n_##_##_tone_ NOTIFY schemeChanged) \
181 QColor _n_##_##_tone_() const { return m_scheme._n_##_palette.get(_tone_); }
195 auto mode() const ->
Enum::ThemeMode;
196 auto sysColorScheme() const ->
Enum::ThemeMode;
198 QColor sysAccentColor() const;
202 auto paletteType() const ->
Enum::PaletteType;
203 void setPaletteType(
Enum::PaletteType);
205 Q_INVOKABLE QColor getOn(QColor) const;
207 Q_SLOT
void setMode(
Enum::ThemeMode);
208 Q_SLOT
void setAccentColor(QColor);
209 Q_SLOT
void setUseSysColorSM(
bool);
210 Q_SLOT
void setUseSysAccentColor(
bool);
211 Q_SLOT
void genScheme();
212 Q_SLOT
void refrehFromSystem();
214 Q_SLOT
void selectFromImage(const QImage&);
216 Q_SIGNAL
void modeChanged(
Enum::ThemeMode);
217 Q_SIGNAL
void schemeChanged();
218 Q_SIGNAL
void paletteTypeChanged();
219 Q_SIGNAL
void accentColorChanged(QColor);
220 Q_SIGNAL
void useSysColorSMChanged();
221 Q_SIGNAL
void useSysAccentColorChanged();
224 void genSchemeImpl(
Enum::ThemeMode);
226 QColor m_accent_color;
227 Enum::ThemeMode m_mode;
228 Enum::ThemeMode m_last_mode;
229 Enum::PaletteType m_scheme_type;
231 bool m_use_sys_color_scheme;
232 bool m_use_sys_accent_color;
236auto sysColorScheme() ->
Enum::ThemeMode;
237auto sysAccentColor() -> QColor;
Enum.
Definition enum.hpp:13
ThemeMode
Definition enum.hpp:20
Material Design Color Manager class.
Definition color.hpp:19
QColor surface_container_lowest
Lowest container variant of surface color.
Definition color.hpp:166
QColor tertiary_fixed_dim
Stronger tone of tertiary fixed.
Definition color.hpp:108
QColor surface_3
Third elevation variant of surface color.
Definition color.hpp:152
bool useSysColorSM
Whether to use system color scheme mode.
Definition color.hpp:52
QColor surface_dim
Dimmed version of surface color.
Definition color.hpp:158
QColor surface_container_low
Low container variant of surface color.
Definition color.hpp:164
QColor on_surface
Color for content on surface.
Definition color.hpp:128
QColor background
Main background color.
Definition color.hpp:122
QColor primary_container
A softer background color related to primary.
Definition color.hpp:70
QColor on_primary
Color used for content (text/icons) on primary color.
Definition color.hpp:68
QColor tertiary_fixed
Tertiary container that stays the same between light and dark themes.
Definition color.hpp:106
QColor on_tertiary_fixed_variant
Lower-emphasis color for content on tertiary fixed.
Definition color.hpp:112
QColor surface_container_highest
Highest container variant of surface color.
Definition color.hpp:170
QColor secondary_fixed_dim
Stronger tone of secondary fixed.
Definition color.hpp:92
QColor on_secondary
Color for content on secondary color.
Definition color.hpp:84
QColor surface_container
Base container variant of surface color.
Definition color.hpp:162
QColor error
Color used for error states.
Definition color.hpp:114
QColor on_primary_fixed_variant
Lower-emphasis color for content on primary fixed.
Definition color.hpp:80
QColor on_tertiary_fixed
Color for content on tertiary fixed.
Definition color.hpp:110
QColor shadow
Color used for shadows.
Definition color.hpp:138
QColor surface_container_high
High container variant of surface color.
Definition color.hpp:168
QColor on_error_container
Color for content on error container.
Definition color.hpp:120
QColor error_container
A softer background color for error states.
Definition color.hpp:118
QColor inverse_surface
Inverse of the surface color.
Definition color.hpp:142
QColor tertiary_container
A softer background color related to tertiary.
Definition color.hpp:102
QColor surface_1
First elevation variant of surface color.
Definition color.hpp:148
qml_material::Enum::ThemeMode mode
Current theme mode (light/dark)
Definition color.hpp:31
QColor on_primary_fixed
Color for content on primary fixed.
Definition color.hpp:78
QColor inverse_on_surface
Color for content on inverse surface.
Definition color.hpp:144
QColor on_error
Color for content on error color.
Definition color.hpp:116
QColor on_background
Color for content on background.
Definition color.hpp:124
QColor surface
Surface color for cards, sheets, and menus.
Definition color.hpp:126
QColor surface_bright
Brightened version of surface color.
Definition color.hpp:160
QColor surface_4
Fourth elevation variant of surface color.
Definition color.hpp:154
QColor secondary_fixed
Secondary container that stays the same between light and dark themes.
Definition color.hpp:90
QColor secondary
The secondary color used for less prominent components.
Definition color.hpp:82
QColor primary
The primary color of the theme.
Definition color.hpp:66
QColor on_secondary_fixed
Color for content on secondary fixed.
Definition color.hpp:94
QColor primary_fixed_dim
Stronger tone of primary fixed.
Definition color.hpp:76
QColor inverse_primary
Inverse of the primary color.
Definition color.hpp:146
QColor on_tertiary_container
Color for content on tertiary container.
Definition color.hpp:104
QColor primary_fixed
Primary container that stays the same between light and dark themes.
Definition color.hpp:74
QColor surface_variant
Alternative surface color.
Definition color.hpp:130
QColor on_tertiary
Color for content on tertiary color.
Definition color.hpp:100
QColor on_secondary_fixed_variant
Lower-emphasis color for content on secondary fixed.
Definition color.hpp:96
QColor accentColor
Primary accent color for the theme.
Definition color.hpp:45
QColor on_surface_variant
Color for content on surface variant.
Definition color.hpp:132
QColor outline
Color for borders and dividers.
Definition color.hpp:134
QColor surface_5
Fifth elevation variant of surface color.
Definition color.hpp:156
QColor secondary_container
A softer background color related to secondary.
Definition color.hpp:86
QColor tertiary
The tertiary color for specific emphasis.
Definition color.hpp:98
QColor scrim
Color used for screen dimming.
Definition color.hpp:140
QColor on_primary_container
Color for content on primary container.
Definition color.hpp:72
QColor outline_variant
Subtle version of outline color.
Definition color.hpp:136
bool useSysAccentColor
Whether to use system accent color.
Definition color.hpp:59
QColor surface_2
Second elevation variant of surface color.
Definition color.hpp:150
QColor on_secondary_container
Color for content on secondary container.
Definition color.hpp:88