mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
refactor(palette): color terminology
This commit is contained in:
@@ -873,15 +873,15 @@
|
||||
},
|
||||
"capsule_border": {
|
||||
"label": "Capsule Border",
|
||||
"description": "Theme role for the capsule outline"
|
||||
"description": "Color role for the capsule outline"
|
||||
},
|
||||
"capsule_fill": {
|
||||
"label": "Capsule Fill",
|
||||
"description": "Theme role for the capsule background"
|
||||
"description": "Color role for the capsule background"
|
||||
},
|
||||
"capsule_foreground": {
|
||||
"label": "Capsule Foreground",
|
||||
"description": "Theme role for content inside the capsule"
|
||||
"description": "Color role for content inside the capsule"
|
||||
},
|
||||
"capsule_opacity": {
|
||||
"label": "Capsule Opacity",
|
||||
@@ -893,7 +893,7 @@
|
||||
},
|
||||
"color": {
|
||||
"label": "Color",
|
||||
"description": "Theme role for widget foreground"
|
||||
"description": "Color role for widget foreground"
|
||||
},
|
||||
"cycle_command": {
|
||||
"label": "Cycle Command",
|
||||
@@ -1465,19 +1465,19 @@
|
||||
},
|
||||
"widget-color": {
|
||||
"label": "Widget Color",
|
||||
"description": "Default icon and label theme role for widgets on this bar"
|
||||
"description": "Default icon and label color role for widgets on this bar"
|
||||
},
|
||||
"capsule-fill": {
|
||||
"label": "Capsule Fill",
|
||||
"description": "Default capsule background theme role"
|
||||
"description": "Default capsule background color role"
|
||||
},
|
||||
"capsule-border": {
|
||||
"label": "Capsule Border",
|
||||
"description": "Default capsule outline theme role"
|
||||
"description": "Default capsule outline color role"
|
||||
},
|
||||
"capsule-foreground": {
|
||||
"label": "Capsule Foreground",
|
||||
"description": "Default icon and label theme role inside capsules"
|
||||
"description": "Default icon and label color role inside capsules"
|
||||
},
|
||||
"widget-spacing": {
|
||||
"label": "Widget Spacing",
|
||||
|
||||
+9
-9
@@ -105,12 +105,12 @@ Set under `[bar.<name>]` or `[bar.<name>.monitor.*]`:
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `capsule` | bool | `false` | `true` gives every widget a capsule unless `[widget.*]` sets `capsule = false`. |
|
||||
| `color` | string | *(unset)* | Default icon + label color for every widget on this bar. |
|
||||
| `capsule_fill` | string | `surface_variant` | Default capsule background theme role. |
|
||||
| `capsule_foreground` | string | *(unset)* | Default icon + label color for capped widgets. |
|
||||
| `color` | string | *(unset)* | Default icon + label color role or hex color for every widget on this bar. |
|
||||
| `capsule_fill` | string | `surface_variant` | Default capsule background color role or hex color. |
|
||||
| `capsule_foreground` | string | *(unset)* | Default icon + label color role or hex color for capped widgets. |
|
||||
| `capsule_padding` | number | `6` | Inner padding in logical pixels before `scale` is applied (clamped 0–48). |
|
||||
| `capsule_opacity` | number | `1.0` | Capsule background opacity (0.0–1.0). |
|
||||
| `capsule_border` | string | *(omitted)* | If omitted, no border by default. If present (even `""`), per-widget border rules apply. |
|
||||
| `capsule_border` | string | *(omitted)* | Color role or hex color for the capsule border. If omitted, no border by default. If present as `""`, no border. |
|
||||
|
||||
### Per-widget overrides
|
||||
|
||||
@@ -119,14 +119,14 @@ Set under `[widget.<name>]`:
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `capsule` | bool | *(from bar)* | Omit to inherit bar flag; `false` disables; `true` forces on. |
|
||||
| `capsule_fill` | string | *(from bar)* | Capsule background color. |
|
||||
| `capsule_foreground` | string | *(from bar)* | Icon + label color when capsule is visible. `color` takes priority over this. |
|
||||
| `capsule_fill` | string | *(from bar)* | Capsule background color role or hex color. |
|
||||
| `capsule_foreground` | string | *(from bar)* | Icon + label color role or hex color when capsule is visible. `color` takes priority over this. |
|
||||
| `capsule_padding` | number | *(from bar)* | Per-widget inner padding (0–48). |
|
||||
| `capsule_opacity` | number | *(from bar)* | Per-widget capsule background opacity. |
|
||||
| `capsule_border` | string | *(from bar)* | Omit to inherit bar policy. Present but empty/whitespace-only = no border. |
|
||||
| `color` | string | *(unset)* | Icon + label color with or without capsule. Resolution order: `color` → `capsule_foreground` → built-in defaults. |
|
||||
| `capsule_border` | string | *(from bar)* | Color role or hex color for the capsule border. Omit to inherit bar policy. Present but empty/whitespace-only = no border. |
|
||||
| `color` | string | *(unset)* | Icon + label color role or hex color with or without capsule. Resolution order: `color` → `capsule_foreground` → built-in defaults. |
|
||||
|
||||
Theme role names use **snake_case** (e.g. `on_surface`, `surface_variant`, `secondary`). Arbitrary hex colors are not accepted here; these settings use the shell's classic 16 theme roles.
|
||||
Color role names use **snake_case** (e.g. `on_surface`, `surface_variant`, `secondary`). Hex colors may use `#RGB`, `#RGBA`, `#RRGGBB`, or `#RRGGBBAA`.
|
||||
|
||||
The capsule is hidden automatically when a widget reports no visible ink (empty tray, absent battery, invisible root). Subclasses may override `Widget::shouldShowBarCapsule()`.
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ All desktop widget types support an optional rounded background rectangle:
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `background` | bool | `false` | Show a filled rounded rectangle behind the widget |
|
||||
| `background_color` | string | `"surface"` (80% opacity) | Background fill theme role |
|
||||
| `background_color` | string | `"surface"` (80% opacity) | Background fill color role or hex color |
|
||||
| `background_radius` | float | `12.0` | Corner radius in logical pixels |
|
||||
| `background_padding` | float | `10.0` | Padding between content and background edge |
|
||||
|
||||
@@ -104,7 +104,7 @@ The `clock`, `weather`, `media_player`, and `sysmon` widget types additionally s
|
||||
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `color` | string | `"on_surface"` | Text/glyph theme role (e.g. `"primary"`, `"tertiary"`) |
|
||||
| `color` | string | `"on_surface"` | Text/glyph color role or hex color (e.g. `"primary"`, `"tertiary"`) |
|
||||
| `shadow` | bool | `true` | Draw a drop shadow behind text and glyphs for readability on wallpapers |
|
||||
|
||||
```toml
|
||||
@@ -168,8 +168,8 @@ high_color = "secondary"
|
||||
| `aspect_ratio` | float | `2.5` | Width-to-height ratio |
|
||||
| `min_value` | float | `0.02` | Minimum displayed band height for widgets created in edit mode; omit or set `0.0` for no floor |
|
||||
| `mirrored` | bool | `true` | Mirror the spectrum horizontally |
|
||||
| `low_color` | string | `"primary"` | Gradient low-end theme role |
|
||||
| `high_color` | string | `"primary"` | Gradient high-end theme role |
|
||||
| `low_color` | string | `"primary"` | Gradient low-end color role or hex color |
|
||||
| `high_color` | string | `"primary"` | Gradient high-end color role or hex color |
|
||||
|
||||
---
|
||||
|
||||
@@ -274,6 +274,6 @@ background = true
|
||||
|---------|------|---------|-------------|
|
||||
| `stat` | string | `"cpu_usage"` | Primary stat: `"cpu_usage"`, `"cpu_temp"`, `"ram_pct"`, `"swap_pct"` |
|
||||
| `stat2` | string | — | Optional secondary stat (same values as `stat`). Omit for single curve. |
|
||||
| `color` | string | `"primary"` | Primary line theme role |
|
||||
| `color2` | string | `"secondary"` | Secondary line color (used when `stat2` is set) |
|
||||
| `color` | string | `"primary"` | Primary line color role or hex color |
|
||||
| `color2` | string | `"secondary"` | Secondary line color role or hex color (used when `stat2` is set) |
|
||||
| `show_label` | bool | `true` | Show the current value as text next to the icon |
|
||||
|
||||
@@ -40,14 +40,14 @@ my_setting = "value"
|
||||
| `barWidget.setText(text)` | — | Set the label text |
|
||||
| `barWidget.setGlyph(name)` | — | Set the icon by Tabler icon name |
|
||||
| `barWidget.setGlyphCodepoint(cp)` | — | Set the icon by Unicode codepoint |
|
||||
| `barWidget.setColor(role)` | — | Set the label color by theme role |
|
||||
| `barWidget.setGlyphColor(role)` | — | Set the glyph color by theme role |
|
||||
| `barWidget.setColor(role)` | — | Set the label color by color role |
|
||||
| `barWidget.setGlyphColor(role)` | — | Set the glyph color by color role |
|
||||
| `barWidget.setVisible(visible)` | — | Show or hide the entire widget |
|
||||
| `barWidget.setUpdateInterval(ms)` | — | Set the `update()` tick interval in milliseconds (default 250, minimum 16) |
|
||||
| `barWidget.isVertical()` | `boolean` | Whether the bar is in vertical orientation |
|
||||
| `barWidget.getConfig(key, default?)` | `any` | Read a TOML config setting. Returns the typed value or default/nil. |
|
||||
|
||||
**Theme color roles:** `primary`, `on_primary`, `secondary`, `on_secondary`, `tertiary`, `on_tertiary`, `error`, `on_error`, `surface`, `on_surface`, `surface_variant`, `on_surface_variant`, `outline`, `shadow`, `hover`, `on_hover`.
|
||||
**Color roles:** `primary`, `on_primary`, `secondary`, `on_secondary`, `tertiary`, `on_tertiary`, `error`, `on_error`, `surface`, `on_surface`, `surface_variant`, `on_surface_variant`, `outline`, `shadow`, `hover`, `on_hover`.
|
||||
|
||||
### Lua callbacks
|
||||
|
||||
|
||||
+1
-1
@@ -139,7 +139,7 @@ started = "systemctl --user start noctalia-ready.target"
|
||||
wallpaper_changed = "systemctl --user restart wallpaper-sync.service"
|
||||
colors_changed = [
|
||||
"systemctl --user reload foot-server.service",
|
||||
"logger -t noctalia-hooks 'theme colors changed'",
|
||||
"logger -t noctalia-hooks 'palette colors changed'",
|
||||
]
|
||||
|
||||
# Combine normal shell commands with Noctalia IPC commands.
|
||||
|
||||
+3
-2
@@ -67,11 +67,12 @@ Picks the generator when `source = "wallpaper"`:
|
||||
|
||||
## Shell Color Roles
|
||||
|
||||
User-facing shell color settings use these 16 theme roles:
|
||||
User-facing shell color settings can reference these 16 color roles:
|
||||
|
||||
`primary`, `on_primary`, `secondary`, `on_secondary`, `tertiary`, `on_tertiary`, `error`, `on_error`, `surface`, `on_surface`, `surface_variant`, `on_surface_variant`, `outline`, `shadow`, `hover`, `on_hover`
|
||||
|
||||
Role names are lowercase `snake_case`. Arbitrary hex colors are intentionally not accepted in shell/widget config.
|
||||
Role names are lowercase `snake_case`. Config fields parsed as palette colors may also accept hex colors where a fixed
|
||||
color is needed; Settings role pickers expose the 16 roles.
|
||||
|
||||
### IPC
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ If a block tag appears alone on a line, with only whitespace around it, that who
|
||||
|
||||
## Data Model
|
||||
|
||||
### Theme Colors
|
||||
### Palette Colors
|
||||
|
||||
Colors are accessed with:
|
||||
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ directory_dark = "/home/user/Wallpapers/Vertical/Dark"
|
||||
|
||||
The wallpaper picker panel lists images in `directory` as a grid of thumbnails. Selecting a monitor in the panel toolbar switches to that monitor's override directory (falling back to the base `directory`). Clicking a tile writes the path to `state.toml` and applies it immediately. Picking a wallpaper while **ALL** is selected applies it to every connected output. Picking a solid color stores it as a wallpaper source path such as `color:#FF00FF`, so it uses the same transition shader pipeline as image wallpapers.
|
||||
|
||||
`fill_color` accepts hex colors (`#RGB`, `#RGBA`, `#RRGGBB`, `#RRGGBBAA`) or theme role names such as `surface` and `primary`. It is used behind image wallpapers and in uncovered areas for `center`/`fit`.
|
||||
`fill_color` accepts hex colors (`#RGB`, `#RGBA`, `#RRGGBB`, `#RRGGBBAA`) or color role names such as `surface` and `primary`. It is used behind image wallpapers and in uncovered areas for `center`/`fit`.
|
||||
|
||||
Monitor overrides may also set `fill_color`.
|
||||
|
||||
|
||||
+2
-2
@@ -194,8 +194,8 @@ Horizontal audio spectrum using the current PipeWire monitor stream.
|
||||
| `bands` | number | `16` | Number of spectrum bands |
|
||||
| `mirrored` | bool | `false` | Mirror the spectrum around the center line |
|
||||
| `show_when_idle` | bool | `false` | Keep the widget visible even when no media is playing |
|
||||
| `low_color` | string | `"primary"` | Theme role for the first bars |
|
||||
| `high_color` | string | `"primary"` | Theme role for the last bars |
|
||||
| `low_color` | string | `"primary"` | Color role or hex color for the first bars |
|
||||
| `high_color` | string | `"primary"` | Color role or hex color for the last bars |
|
||||
|
||||
```toml
|
||||
[widget.audio-vis]
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ blacklist = [] # ignore MPRIS players by bus/identity/deskt
|
||||
[wallpaper]
|
||||
enabled = true
|
||||
fill_mode = "crop" # center | crop | fit | stretch | repeat
|
||||
fill_color = "" # optional fallback/fill color: #RRGGBB, #RRGGBBAA, or theme role
|
||||
fill_color = "" # optional fallback/fill color: #RRGGBB, #RRGGBBAA, or color role
|
||||
transition = ["fade", "wipe", "disc", "stripes", "zoom", "honeycomb"]
|
||||
transition_duration = 1500 # milliseconds
|
||||
edge_smoothness = 0.3
|
||||
|
||||
@@ -249,24 +249,11 @@ namespace {
|
||||
|
||||
void stripInternalState(toml::table& table) { table.erase(kInternalStateTable); }
|
||||
|
||||
ThemeColor themeColorFromRoleString(const std::string& raw) {
|
||||
const std::string trimmed = StringUtils::trim(raw);
|
||||
Color fixed;
|
||||
if (tryParseHexColor(trimmed, fixed)) {
|
||||
return fixedColor(fixed);
|
||||
}
|
||||
if (auto role = colorRoleFromToken(trimmed)) {
|
||||
return roleColor(*role);
|
||||
}
|
||||
kLog.warn("unknown theme color role \"{}\", using surface_variant", raw);
|
||||
return roleColor(ColorRole::SurfaceVariant);
|
||||
}
|
||||
|
||||
std::optional<ThemeColor> optionalCapsuleBorder(const std::string& raw) {
|
||||
std::optional<ColorSpec> optionalCapsuleBorder(const std::string& raw) {
|
||||
if (StringUtils::trim(raw).empty()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
return themeColorFromRoleString(raw);
|
||||
return colorSpecFromConfigString(raw);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -928,10 +915,10 @@ void ConfigService::parseTable(const toml::table& tbl) {
|
||||
bar.widgetCapsuleDefault = *v;
|
||||
}
|
||||
if (auto fillStr = (*barTbl)["capsule_fill"].value<std::string>()) {
|
||||
bar.widgetCapsuleFill = themeColorFromRoleString(*fillStr);
|
||||
bar.widgetCapsuleFill = colorSpecFromConfigString(*fillStr);
|
||||
}
|
||||
if (auto fgStr = (*barTbl)["capsule_foreground"].value<std::string>()) {
|
||||
bar.widgetCapsuleForeground = themeColorFromRoleString(*fgStr);
|
||||
bar.widgetCapsuleForeground = colorSpecFromConfigString(*fgStr);
|
||||
}
|
||||
if (auto v = (*barTbl)["capsule_padding"].value<double>()) {
|
||||
bar.widgetCapsulePadding = std::clamp(static_cast<float>(*v), 0.0f, 48.0f);
|
||||
@@ -948,7 +935,7 @@ void ConfigService::parseTable(const toml::table& tbl) {
|
||||
bar.widgetCapsuleBorder = optionalCapsuleBorder(borderStr);
|
||||
}
|
||||
if (auto widgetColorStr = (*barTbl)["color"].value<std::string>()) {
|
||||
bar.widgetColor = themeColorFromRoleString(*widgetColorStr);
|
||||
bar.widgetColor = colorSpecFromConfigString(*widgetColorStr);
|
||||
}
|
||||
|
||||
// Parse [bar.<name>.monitor.*] overrides — insertion order preserved by toml++
|
||||
@@ -1011,10 +998,10 @@ void ConfigService::parseTable(const toml::table& tbl) {
|
||||
ovr.widgetCapsuleDefault = *v;
|
||||
}
|
||||
if (auto fillStr = (*monTbl)["capsule_fill"].value<std::string>()) {
|
||||
ovr.widgetCapsuleFill = themeColorFromRoleString(*fillStr);
|
||||
ovr.widgetCapsuleFill = colorSpecFromConfigString(*fillStr);
|
||||
}
|
||||
if (auto fgStr = (*monTbl)["capsule_foreground"].value<std::string>()) {
|
||||
ovr.widgetCapsuleForeground = themeColorFromRoleString(*fgStr);
|
||||
ovr.widgetCapsuleForeground = colorSpecFromConfigString(*fgStr);
|
||||
}
|
||||
if (auto v = (*monTbl)["capsule_padding"].value<double>()) {
|
||||
ovr.widgetCapsulePadding = *v;
|
||||
@@ -1031,7 +1018,7 @@ void ConfigService::parseTable(const toml::table& tbl) {
|
||||
ovr.widgetCapsuleBorder = optionalCapsuleBorder(borderStr);
|
||||
}
|
||||
if (auto cStr = (*monTbl)["color"].value<std::string>()) {
|
||||
ovr.widgetColor = themeColorFromRoleString(*cStr);
|
||||
ovr.widgetColor = colorSpecFromConfigString(*cStr);
|
||||
}
|
||||
|
||||
bar.monitorOverrides.push_back(std::move(ovr));
|
||||
@@ -1253,7 +1240,7 @@ void ConfigService::parseTable(const toml::table& tbl) {
|
||||
if (StringUtils::trim(*v).empty()) {
|
||||
wp.fillColor = std::nullopt;
|
||||
} else {
|
||||
wp.fillColor = themeColorFromConfigString(*v);
|
||||
wp.fillColor = colorSpecFromConfigString(*v);
|
||||
}
|
||||
}
|
||||
if (auto* arr = (*wpTbl)["transition"].as_array()) {
|
||||
@@ -1315,7 +1302,7 @@ void ConfigService::parseTable(const toml::table& tbl) {
|
||||
if (StringUtils::trim(*v).empty()) {
|
||||
ovr.fillColor = std::nullopt;
|
||||
} else {
|
||||
ovr.fillColor = themeColorFromConfigString(*v);
|
||||
ovr.fillColor = colorSpecFromConfigString(*v);
|
||||
}
|
||||
}
|
||||
if (auto v = (*monTbl)["directory"].value<std::string>())
|
||||
|
||||
+10
-10
@@ -10,24 +10,24 @@
|
||||
namespace {
|
||||
constexpr Logger kLog("config");
|
||||
|
||||
ThemeColor themeColorFromRoleString(const std::string& raw) {
|
||||
ColorSpec parseColorSpecString(const std::string& raw) {
|
||||
const std::string trimmed = StringUtils::trim(raw);
|
||||
Color fixed;
|
||||
if (tryParseHexColor(trimmed, fixed)) {
|
||||
return fixedColor(fixed);
|
||||
return fixedColorSpec(fixed);
|
||||
}
|
||||
if (auto role = colorRoleFromToken(trimmed)) {
|
||||
return roleColor(*role);
|
||||
return colorSpecFromRole(*role);
|
||||
}
|
||||
kLog.warn("unknown theme color role \"{}\", using surface_variant", raw);
|
||||
return roleColor(ColorRole::SurfaceVariant);
|
||||
kLog.warn("unknown color role \"{}\", using surface_variant", raw);
|
||||
return colorSpecFromRole(ColorRole::SurfaceVariant);
|
||||
}
|
||||
|
||||
std::optional<ThemeColor> optionalCapsuleBorder(const std::string& raw) {
|
||||
std::optional<ColorSpec> optionalCapsuleBorder(const std::string& raw) {
|
||||
if (StringUtils::trim(raw).empty()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
return themeColorFromRoleString(raw);
|
||||
return parseColorSpecString(raw);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -113,7 +113,7 @@ WidgetBarCapsuleSpec resolveWidgetBarCapsuleSpec(const BarConfig& bar, const Wid
|
||||
}
|
||||
|
||||
if (widgetHasFillKey) {
|
||||
spec.fill = themeColorFromRoleString(widget->getString("capsule_fill", ""));
|
||||
spec.fill = parseColorSpecString(widget->getString("capsule_fill", ""));
|
||||
} else {
|
||||
spec.fill = bar.widgetCapsuleFill;
|
||||
}
|
||||
@@ -138,7 +138,7 @@ WidgetBarCapsuleSpec resolveWidgetBarCapsuleSpec(const BarConfig& bar, const Wid
|
||||
}
|
||||
|
||||
if (widget != nullptr && widget->hasSetting("capsule_foreground")) {
|
||||
spec.foreground = themeColorFromRoleString(widget->getString("capsule_foreground", ""));
|
||||
spec.foreground = parseColorSpecString(widget->getString("capsule_foreground", ""));
|
||||
} else if (bar.widgetCapsuleForeground.has_value()) {
|
||||
spec.foreground = bar.widgetCapsuleForeground;
|
||||
} else {
|
||||
@@ -147,7 +147,7 @@ WidgetBarCapsuleSpec resolveWidgetBarCapsuleSpec(const BarConfig& bar, const Wid
|
||||
return spec;
|
||||
}
|
||||
|
||||
ThemeColor themeColorFromConfigString(const std::string& raw) { return themeColorFromRoleString(raw); }
|
||||
ColorSpec colorSpecFromConfigString(const std::string& raw) { return parseColorSpecString(raw); }
|
||||
|
||||
std::optional<HookKind> hookKindFromKey(std::string_view key) { return enumFromKey(kHookKinds, key); }
|
||||
|
||||
|
||||
+15
-15
@@ -38,11 +38,11 @@ struct BarMonitorOverride {
|
||||
std::optional<std::vector<std::string>> centerWidgets;
|
||||
std::optional<std::vector<std::string>> endWidgets;
|
||||
std::optional<bool> widgetCapsuleDefault;
|
||||
std::optional<ThemeColor> widgetCapsuleFill;
|
||||
std::optional<ColorSpec> widgetCapsuleFill;
|
||||
bool widgetCapsuleBorderSpecified = false;
|
||||
std::optional<ThemeColor> widgetCapsuleBorder;
|
||||
std::optional<ThemeColor> widgetCapsuleForeground;
|
||||
std::optional<ThemeColor> widgetColor;
|
||||
std::optional<ColorSpec> widgetCapsuleBorder;
|
||||
std::optional<ColorSpec> widgetCapsuleForeground;
|
||||
std::optional<ColorSpec> widgetColor;
|
||||
std::optional<double> widgetCapsulePadding;
|
||||
std::optional<double> widgetCapsuleOpacity;
|
||||
|
||||
@@ -76,19 +76,19 @@ struct BarConfig {
|
||||
"battery", "control-center", "session"};
|
||||
// When true, widgets on this bar use a capsule unless `[widget.*] capsule = false`.
|
||||
bool widgetCapsuleDefault = false;
|
||||
ThemeColor widgetCapsuleFill = roleColor(ColorRole::SurfaceVariant);
|
||||
ColorSpec widgetCapsuleFill = colorSpecFromRole(ColorRole::SurfaceVariant);
|
||||
// When set, bar widgets with capsules use this for icon + primary label color unless overridden per widget.
|
||||
std::optional<ThemeColor> widgetCapsuleForeground;
|
||||
std::optional<ColorSpec> widgetCapsuleForeground;
|
||||
// Default icon + primary label color for all widgets on this bar (same as per-widget `color`); per-widget `color`
|
||||
// overrides.
|
||||
std::optional<ThemeColor> widgetColor;
|
||||
std::optional<ColorSpec> widgetColor;
|
||||
// Inner padding between capsule edge and widget content (logical px), multiplied by widget content scale on the bar.
|
||||
float widgetCapsulePadding = Style::barCapsulePadding;
|
||||
// Capsule background opacity multiplier (0.0–1.0).
|
||||
float widgetCapsuleOpacity = 1.0f;
|
||||
// True when `capsule_border` appears under `[bar.*]` (empty value = no outline for widgets that inherit border).
|
||||
bool widgetCapsuleBorderSpecified = false;
|
||||
std::optional<ThemeColor> widgetCapsuleBorder;
|
||||
std::optional<ColorSpec> widgetCapsuleBorder;
|
||||
std::vector<BarMonitorOverride> monitorOverrides;
|
||||
|
||||
bool operator==(const BarConfig&) const = default;
|
||||
@@ -101,11 +101,11 @@ using ConfigOverrideValue = std::variant<bool, std::int64_t, double, std::string
|
||||
// Corner shape (pill), border width, and edge softness are fixed in the shell code; padding is configurable.
|
||||
struct WidgetBarCapsuleSpec {
|
||||
bool enabled = false;
|
||||
ThemeColor fill = roleColor(ColorRole::SurfaceVariant);
|
||||
ColorSpec fill = colorSpecFromRole(ColorRole::SurfaceVariant);
|
||||
// Set only when `capsule_border` is present and non-empty in config; otherwise no outline.
|
||||
std::optional<ThemeColor> border;
|
||||
std::optional<ColorSpec> border;
|
||||
// Icon + primary label color when the capsule is visible; unset = widget defaults.
|
||||
std::optional<ThemeColor> foreground;
|
||||
std::optional<ColorSpec> foreground;
|
||||
// Inner padding in logical pixels before content-scale (see `capsule_padding` / bar default).
|
||||
float padding = Style::barCapsulePadding;
|
||||
// Capsule background opacity multiplier (0.0–1.0).
|
||||
@@ -132,8 +132,8 @@ struct WidgetConfig {
|
||||
// Merges `[bar.*]` capsule defaults with `[widget.*]` overrides (see CONFIG.md).
|
||||
[[nodiscard]] WidgetBarCapsuleSpec resolveWidgetBarCapsuleSpec(const BarConfig& bar, const WidgetConfig* widget);
|
||||
|
||||
// Theme role for `[widget.*] color` and other user color strings (same rules as `capsule_fill`).
|
||||
[[nodiscard]] ThemeColor themeColorFromConfigString(const std::string& raw);
|
||||
// Color spec for `[widget.*] color` and other user color strings (same rules as `capsule_fill`).
|
||||
[[nodiscard]] ColorSpec colorSpecFromConfigString(const std::string& raw);
|
||||
|
||||
// Shared output selector matching used by monitor-scoped config and IPC selectors.
|
||||
// Matches connector name exactly, or a word-boundary token within output description.
|
||||
@@ -159,7 +159,7 @@ enum class WallpaperTransition : std::uint8_t {
|
||||
struct WallpaperMonitorOverride {
|
||||
std::string match;
|
||||
std::optional<bool> enabled;
|
||||
std::optional<ThemeColor> fillColor;
|
||||
std::optional<ColorSpec> fillColor;
|
||||
std::optional<std::string> directory;
|
||||
std::optional<std::string> directoryLight;
|
||||
std::optional<std::string> directoryDark;
|
||||
@@ -180,7 +180,7 @@ struct WallpaperAutomationConfig {
|
||||
struct WallpaperConfig {
|
||||
bool enabled = true;
|
||||
WallpaperFillMode fillMode = WallpaperFillMode::Crop;
|
||||
std::optional<ThemeColor> fillColor;
|
||||
std::optional<ColorSpec> fillColor;
|
||||
std::vector<WallpaperTransition> transitions = {WallpaperTransition::Fade, WallpaperTransition::Wipe,
|
||||
WallpaperTransition::Disc, WallpaperTransition::Stripes,
|
||||
WallpaperTransition::Zoom, WallpaperTransition::Honeycomb};
|
||||
|
||||
@@ -334,7 +334,7 @@ void Backdrop::updateRendererState(BackdropInstance& inst) {
|
||||
inst.surface->setTintIntensity(ov.tintIntensity);
|
||||
|
||||
// Tint color from the current surface role.
|
||||
const Color surface = resolveThemeColor(roleColor(ColorRole::Surface));
|
||||
const Color surface = colorForRole(ColorRole::Surface);
|
||||
inst.surface->setTintColor(surface.r, surface.g, surface.b);
|
||||
|
||||
if (inst.currentTexture.id != 0) {
|
||||
|
||||
@@ -64,8 +64,8 @@ namespace {
|
||||
|
||||
constexpr Logger kLog("bar");
|
||||
|
||||
ThemeColor withOpacity(const ThemeColor& color, float opacity) {
|
||||
ThemeColor out = color;
|
||||
ColorSpec withOpacity(const ColorSpec& color, float opacity) {
|
||||
ColorSpec out = color;
|
||||
out.alpha = std::clamp(out.alpha * std::clamp(opacity, 0.0f, 1.0f), 0.0f, 1.0f);
|
||||
return out;
|
||||
}
|
||||
@@ -872,7 +872,7 @@ void Bar::populateWidgets(BarInstance& instance) {
|
||||
}
|
||||
widget->setBarCapsuleSpec(resolveWidgetBarCapsuleSpec(instance.barConfig, wcPtr));
|
||||
if (wcPtr != nullptr && wcPtr->hasSetting("color")) {
|
||||
widget->setWidgetForeground(themeColorFromConfigString(wcPtr->getString("color", "")));
|
||||
widget->setWidgetForeground(colorSpecFromConfigString(wcPtr->getString("color", "")));
|
||||
} else if (instance.barConfig.widgetColor.has_value()) {
|
||||
widget->setWidgetForeground(*instance.barConfig.widgetColor);
|
||||
}
|
||||
@@ -1015,8 +1015,8 @@ void Bar::applyBackgroundPalette(BarInstance& instance) {
|
||||
return;
|
||||
}
|
||||
auto style = instance.bg->style();
|
||||
style.fill = resolveThemeColor(roleColor(ColorRole::Surface, instance.barConfig.backgroundOpacity));
|
||||
style.border = resolveThemeColor(roleColor(ColorRole::Outline));
|
||||
style.fill = colorForRole(ColorRole::Surface, instance.barConfig.backgroundOpacity);
|
||||
style.border = colorForRole(ColorRole::Outline);
|
||||
instance.bg->setStyle(style);
|
||||
}
|
||||
|
||||
@@ -1216,9 +1216,9 @@ void Bar::buildScene(BarInstance& instance, std::uint32_t width, std::uint32_t h
|
||||
// draws only outside the rect, so any size mismatch is visible at corners.
|
||||
if (instance.bg != nullptr) {
|
||||
const RoundedRectStyle bgStyle{
|
||||
.fill = resolveThemeColor(roleColor(ColorRole::Surface, instance.barConfig.backgroundOpacity)),
|
||||
.fill = colorForRole(ColorRole::Surface, instance.barConfig.backgroundOpacity),
|
||||
.fillEnd = {},
|
||||
.border = resolveThemeColor(roleColor(ColorRole::Outline)),
|
||||
.border = colorForRole(ColorRole::Outline),
|
||||
.fillMode = FillMode::Solid,
|
||||
.radius = barRadii,
|
||||
.softness = 0.0f,
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace {
|
||||
|
||||
} // namespace
|
||||
|
||||
ThemeColor Widget::widgetForegroundOr(const ThemeColor& fallback) const noexcept {
|
||||
ColorSpec Widget::widgetForegroundOr(const ColorSpec& fallback) const noexcept {
|
||||
// Per-widget `color` must win over bar/widget `capsule_foreground`, otherwise a bar-level
|
||||
// capsule_foreground (e.g. on_primary) overrides explicit `color = primary` after layout.
|
||||
if (m_widgetForeground.has_value()) {
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
[[nodiscard]] bool isAnchor() const noexcept { return m_anchor; }
|
||||
|
||||
void setBarCapsuleSpec(WidgetBarCapsuleSpec spec) noexcept { m_barCapsuleSpec = std::move(spec); }
|
||||
void setWidgetForeground(std::optional<ThemeColor> color) noexcept { m_widgetForeground = std::move(color); }
|
||||
void setWidgetForeground(std::optional<ColorSpec> color) noexcept { m_widgetForeground = std::move(color); }
|
||||
[[nodiscard]] const WidgetBarCapsuleSpec& barCapsuleSpec() const noexcept { return m_barCapsuleSpec; }
|
||||
void setBarCapsuleScene(Node* shell, Box* box) noexcept;
|
||||
[[nodiscard]] Node* barCapsuleShell() const noexcept { return m_capsuleShell; }
|
||||
@@ -61,8 +61,8 @@ public:
|
||||
[[nodiscard]] virtual bool shouldShowBarCapsule() const;
|
||||
|
||||
// Resolved icon + primary label color: `[widget.*] color` when set, else `capsule_foreground` when the capsule is
|
||||
// visible, else `fallback` (e.g. roleColor(OnSurface)).
|
||||
[[nodiscard]] ThemeColor widgetForegroundOr(const ThemeColor& fallback) const noexcept;
|
||||
// visible, else `fallback` (e.g. colorSpecFromRole(OnSurface)).
|
||||
[[nodiscard]] ColorSpec widgetForegroundOr(const ColorSpec& fallback) const noexcept;
|
||||
|
||||
protected:
|
||||
void requestUpdate();
|
||||
@@ -80,7 +80,7 @@ protected:
|
||||
RedrawCallback m_redrawCallback;
|
||||
PanelToggleCallback m_panelToggleCallback;
|
||||
WidgetBarCapsuleSpec m_barCapsuleSpec{};
|
||||
std::optional<ThemeColor> m_widgetForeground;
|
||||
std::optional<ColorSpec> m_widgetForeground;
|
||||
Node* m_capsuleShell = nullptr;
|
||||
Box* m_capsuleBox = nullptr;
|
||||
|
||||
|
||||
@@ -91,10 +91,10 @@ std::unique_ptr<Widget> WidgetFactory::create(const std::string& name, wl_output
|
||||
const int bands = static_cast<int>(wc != nullptr ? wc->getInt("bands", 16) : 16);
|
||||
const bool mirrored = wc != nullptr ? wc->getBool("mirrored", false) : false;
|
||||
const bool showWhenIdle = wc != nullptr ? wc->getBool("show_when_idle", false) : false;
|
||||
const ThemeColor lowColor =
|
||||
themeColorFromConfigString(wc != nullptr ? wc->getString("low_color", "primary") : std::string("primary"));
|
||||
const ThemeColor highColor =
|
||||
themeColorFromConfigString(wc != nullptr ? wc->getString("high_color", "primary") : std::string("primary"));
|
||||
const ColorSpec lowColor =
|
||||
colorSpecFromConfigString(wc != nullptr ? wc->getString("low_color", "primary") : std::string("primary"));
|
||||
const ColorSpec highColor =
|
||||
colorSpecFromConfigString(wc != nullptr ? wc->getString("high_color", "primary") : std::string("primary"));
|
||||
auto widget = std::make_unique<AudioVisualizerWidget>(m_audioSpectrum, width, height, bands, mirrored, lowColor,
|
||||
highColor, showWhenIdle);
|
||||
widget->setContentScale(contentScale);
|
||||
|
||||
@@ -44,7 +44,7 @@ void ActiveWindowWidget::create() {
|
||||
auto title = std::make_unique<Label>();
|
||||
title->setBold(true);
|
||||
title->setFontSize(Style::fontSizeBody * m_contentScale);
|
||||
title->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
title->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
title->setMaxWidth(m_maxTitleWidth * m_contentScale);
|
||||
title->setMaxLines(1);
|
||||
title->setStableBaseline(true);
|
||||
@@ -72,7 +72,7 @@ void ActiveWindowWidget::doLayout(Renderer& renderer, float containerWidth, floa
|
||||
m_icon->setVisible(true);
|
||||
|
||||
m_title->setMaxWidth(m_maxTitleWidth * m_contentScale);
|
||||
m_title->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_title->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
|
||||
if (isVertical) {
|
||||
m_title->setVisible(false);
|
||||
@@ -141,7 +141,7 @@ void ActiveWindowWidget::syncState(Renderer& renderer) {
|
||||
|
||||
m_title->setMaxWidth(m_maxTitleWidth * m_contentScale);
|
||||
m_title->setText(m_lastTitle);
|
||||
m_title->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_title->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_title->setVisible(true);
|
||||
m_title->measure(renderer);
|
||||
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
#include <memory>
|
||||
|
||||
AudioVisualizerWidget::AudioVisualizerWidget(PipeWireSpectrum* spectrum, float width, float height, int bands,
|
||||
bool mirrored, ThemeColor lowColor, ThemeColor highColor,
|
||||
bool showWhenIdle)
|
||||
bool mirrored, ColorSpec lowColor, ColorSpec highColor, bool showWhenIdle)
|
||||
: m_spectrum(spectrum), m_width(width), m_height(height), m_bands(std::max(1, bands)), m_mirrored(mirrored),
|
||||
m_showWhenIdle(showWhenIdle), m_lowColor(lowColor), m_highColor(highColor) {}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class Renderer;
|
||||
class AudioVisualizerWidget : public Widget {
|
||||
public:
|
||||
AudioVisualizerWidget(PipeWireSpectrum* spectrum, float width, float height, int bands, bool mirrored,
|
||||
ThemeColor lowColor, ThemeColor highColor, bool showWhenIdle);
|
||||
ColorSpec lowColor, ColorSpec highColor, bool showWhenIdle);
|
||||
~AudioVisualizerWidget() override;
|
||||
|
||||
void create() override;
|
||||
@@ -32,8 +32,8 @@ private:
|
||||
int m_bands = 16;
|
||||
bool m_mirrored = false;
|
||||
bool m_showWhenIdle = false;
|
||||
ThemeColor m_lowColor = roleColor(ColorRole::Primary);
|
||||
ThemeColor m_highColor = roleColor(ColorRole::Primary);
|
||||
ColorSpec m_lowColor = colorSpecFromRole(ColorRole::Primary);
|
||||
ColorSpec m_highColor = colorSpecFromRole(ColorRole::Primary);
|
||||
std::uint64_t m_listenerId = 0;
|
||||
Renderer* m_renderer = nullptr;
|
||||
AudioSpectrum* m_visualizer = nullptr;
|
||||
|
||||
@@ -46,7 +46,7 @@ void BatteryWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph("battery-4");
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph = glyph.get();
|
||||
container->addChild(std::move(glyph));
|
||||
|
||||
@@ -117,13 +117,13 @@ void BatteryWidget::syncState(Renderer& renderer) {
|
||||
|
||||
m_glyph->setGlyph(batteryGlyphName(s.percentage, s.state));
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
m_glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph->measure(renderer);
|
||||
|
||||
const int pct = static_cast<int>(std::round(s.percentage));
|
||||
m_label->setFontSize((m_isVertical ? Style::fontSizeCaption : Style::fontSizeBody) * m_contentScale);
|
||||
m_label->setText(m_isVertical ? std::to_string(pct) : std::to_string(pct) + "%");
|
||||
m_label->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_label->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_label->measure(renderer);
|
||||
|
||||
requestRedraw();
|
||||
|
||||
@@ -56,7 +56,7 @@ void BluetoothWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph("bluetooth");
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph = glyph.get();
|
||||
area->addChild(std::move(glyph));
|
||||
|
||||
@@ -131,14 +131,14 @@ void BluetoothWidget::syncState(Renderer& renderer) {
|
||||
|
||||
m_glyph->setGlyph(glyphForState(s, numConnected));
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
m_glyph->setColor(s.powered ? widgetForegroundOr(roleColor(ColorRole::OnSurface))
|
||||
: roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_glyph->setColor(s.powered ? widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface))
|
||||
: colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_glyph->measure(renderer);
|
||||
|
||||
if (m_label != nullptr) {
|
||||
m_label->setText(alias);
|
||||
m_label->setColor(s.powered ? widgetForegroundOr(roleColor(ColorRole::OnSurface))
|
||||
: roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_label->setColor(s.powered ? widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface))
|
||||
: colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_label->measure(renderer);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ void BrightnessWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph("brightness-high");
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph = glyph.get();
|
||||
area->addChild(std::move(glyph));
|
||||
|
||||
@@ -132,7 +132,7 @@ void BrightnessWidget::syncState(Renderer& renderer) {
|
||||
|
||||
m_glyph->setGlyph(brightnessGlyphName(brightness));
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
m_glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph->measure(renderer);
|
||||
|
||||
m_label->setVisible(m_showLabel);
|
||||
@@ -140,7 +140,7 @@ void BrightnessWidget::syncState(Renderer& renderer) {
|
||||
int pct = static_cast<int>(std::round(brightness * 100.0f));
|
||||
m_label->setFontSize((m_isVertical ? Style::fontSizeCaption : Style::fontSizeBody) * m_contentScale);
|
||||
m_label->setText(m_isVertical ? std::to_string(pct) : std::to_string(pct) + "%");
|
||||
m_label->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_label->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_label->measure(renderer);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ void ClipboardWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph(m_barGlyphId.empty() ? "clipboard" : m_barGlyphId);
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph = glyph.get();
|
||||
area->addChild(std::move(glyph));
|
||||
|
||||
@@ -30,7 +30,7 @@ void ClipboardWidget::doLayout(Renderer& renderer, float /*containerWidth*/, flo
|
||||
return;
|
||||
}
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
m_glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph->measure(renderer);
|
||||
if (auto* node = root(); node != nullptr) {
|
||||
node->setSize(m_glyph->width(), m_glyph->height());
|
||||
|
||||
@@ -71,7 +71,7 @@ void ClockWidget::doLayout(Renderer& renderer, float containerWidth, float conta
|
||||
}
|
||||
m_isVertical = containerHeight > containerWidth;
|
||||
update(renderer);
|
||||
m_label->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_label->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
// Horizontal clocks should use single-line metrics so capsule height matches sibling widgets.
|
||||
m_label->setMaxLines(m_isVertical ? 0 : 1);
|
||||
m_label->setMinWidth(0.0f);
|
||||
|
||||
@@ -19,7 +19,7 @@ void ControlCenterWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph(m_barGlyphId.empty() ? "search" : m_barGlyphId);
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph = glyph.get();
|
||||
area->addChild(std::move(glyph));
|
||||
|
||||
@@ -31,7 +31,7 @@ void ControlCenterWidget::doLayout(Renderer& renderer, float /*containerWidth*/,
|
||||
return;
|
||||
}
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
m_glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph->measure(renderer);
|
||||
auto* node = root();
|
||||
if (node != nullptr) {
|
||||
|
||||
@@ -29,7 +29,7 @@ void IdleInhibitorWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph(glyphForState(false));
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
glyph->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_glyph = glyph.get();
|
||||
area->addChild(std::move(glyph));
|
||||
|
||||
@@ -70,11 +70,11 @@ void IdleInhibitorWidget::syncState(Renderer& renderer) {
|
||||
m_glyph->setGlyph(glyphForState(enabled));
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
if (!available) {
|
||||
m_glyph->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_glyph->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
} else if (enabled) {
|
||||
m_glyph->setColor(roleColor(ColorRole::Primary));
|
||||
m_glyph->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
} else {
|
||||
m_glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
}
|
||||
m_glyph->measure(renderer);
|
||||
m_area->setEnabled(available);
|
||||
|
||||
@@ -314,7 +314,7 @@ void KeyboardLayoutWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph("keyboard");
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph = glyph.get();
|
||||
area->addChild(std::move(glyph));
|
||||
|
||||
@@ -348,7 +348,7 @@ void KeyboardLayoutWidget::doLayout(Renderer& renderer, float containerWidth, fl
|
||||
|
||||
if (m_glyph != nullptr) {
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
m_glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph->measure(renderer);
|
||||
if (m_glyph->width() <= 0.0f) {
|
||||
// Some icon fonts may miss the keyboard glyph; use a guaranteed fallback.
|
||||
@@ -357,7 +357,7 @@ void KeyboardLayoutWidget::doLayout(Renderer& renderer, float containerWidth, fl
|
||||
}
|
||||
}
|
||||
|
||||
m_label->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_label->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_label->setTextAlign(m_isVertical ? TextAlign::Center : TextAlign::Start);
|
||||
const float stableLabelWidth =
|
||||
std::round(renderer.measureText(kVerticalStableLabel, m_label->fontSize(), true).width);
|
||||
@@ -434,7 +434,7 @@ void KeyboardLayoutWidget::sync(Renderer& renderer) {
|
||||
|
||||
m_label->setFontSize((m_isVertical ? Style::fontSizeCaption : Style::fontSizeBody) * m_contentScale);
|
||||
m_label->setText(layoutLabel);
|
||||
m_label->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_label->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_label->measure(renderer);
|
||||
|
||||
if (auto* node = root(); node != nullptr) {
|
||||
|
||||
@@ -18,7 +18,7 @@ void LauncherWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph(m_barGlyphId.empty() ? "video" : m_barGlyphId);
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph = glyph.get();
|
||||
area->addChild(std::move(glyph));
|
||||
|
||||
@@ -30,7 +30,7 @@ void LauncherWidget::doLayout(Renderer& renderer, float /*containerWidth*/, floa
|
||||
return;
|
||||
}
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
m_glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph->measure(renderer);
|
||||
auto* node = root();
|
||||
if (node != nullptr) {
|
||||
|
||||
@@ -110,7 +110,7 @@ void LockKeysWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph("lock");
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph = glyph.get();
|
||||
rootNode->addChild(std::move(glyph));
|
||||
|
||||
@@ -274,7 +274,7 @@ void LockKeysWidget::sync(Renderer& renderer) {
|
||||
|
||||
if (m_glyph != nullptr) {
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
m_glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
}
|
||||
|
||||
const bool full = m_displayMode == DisplayMode::Full;
|
||||
@@ -288,16 +288,16 @@ void LockKeysWidget::sync(Renderer& renderer) {
|
||||
scrollVisible, m_contentScale);
|
||||
|
||||
if (m_capsLabel != nullptr) {
|
||||
m_capsLabel->setColor(lockState.capsLock ? roleColor(ColorRole::Primary)
|
||||
: widgetForegroundOr(roleColor(ColorRole::OnSurfaceVariant)));
|
||||
m_capsLabel->setColor(lockState.capsLock ? colorSpecFromRole(ColorRole::Primary)
|
||||
: widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurfaceVariant)));
|
||||
}
|
||||
if (m_numLabel != nullptr) {
|
||||
m_numLabel->setColor(lockState.numLock ? roleColor(ColorRole::Primary)
|
||||
: widgetForegroundOr(roleColor(ColorRole::OnSurfaceVariant)));
|
||||
m_numLabel->setColor(lockState.numLock ? colorSpecFromRole(ColorRole::Primary)
|
||||
: widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurfaceVariant)));
|
||||
}
|
||||
if (m_scrollLabel != nullptr) {
|
||||
m_scrollLabel->setColor(lockState.scrollLock ? roleColor(ColorRole::Primary)
|
||||
: widgetForegroundOr(roleColor(ColorRole::OnSurfaceVariant)));
|
||||
m_scrollLabel->setColor(lockState.scrollLock ? colorSpecFromRole(ColorRole::Primary)
|
||||
: widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurfaceVariant)));
|
||||
}
|
||||
|
||||
if (auto* node = root(); node != nullptr) {
|
||||
|
||||
@@ -53,7 +53,7 @@ void MediaWidget::create() {
|
||||
auto label = std::make_unique<Label>();
|
||||
label->setBold(true);
|
||||
label->setFontSize(Style::fontSizeBody * m_contentScale);
|
||||
label->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
label->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
label->setMaxWidth(m_maxWidth * m_contentScale);
|
||||
label->setMaxLines(1);
|
||||
label->setStableBaseline(true);
|
||||
@@ -63,7 +63,7 @@ void MediaWidget::create() {
|
||||
auto emptyGlyph = std::make_unique<Glyph>();
|
||||
emptyGlyph->setGlyph("music-off");
|
||||
emptyGlyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
emptyGlyph->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
emptyGlyph->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
emptyGlyph->setVisible(false);
|
||||
m_emptyGlyph = emptyGlyph.get();
|
||||
area->addChild(std::move(emptyGlyph));
|
||||
@@ -81,11 +81,11 @@ void MediaWidget::doLayout(Renderer& renderer, float containerWidth, float conta
|
||||
const bool isVertical = containerHeight > containerWidth;
|
||||
|
||||
m_label->setMaxWidth(m_maxWidth * m_contentScale);
|
||||
m_label->setColor(m_lastPlaybackStatus == "Playing" ? widgetForegroundOr(roleColor(ColorRole::OnSurface))
|
||||
: roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_label->setColor(m_lastPlaybackStatus == "Playing" ? widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface))
|
||||
: colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_label->measure(renderer);
|
||||
m_emptyGlyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
m_emptyGlyph->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_emptyGlyph->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_emptyGlyph->measure(renderer);
|
||||
|
||||
const bool showArtSlot = m_art->hasImage();
|
||||
@@ -175,8 +175,8 @@ void MediaWidget::syncState(Renderer& renderer) {
|
||||
|
||||
m_label->setMaxWidth(m_maxWidth * m_contentScale);
|
||||
m_label->setText(m_lastText);
|
||||
m_label->setColor(m_lastPlaybackStatus == "Playing" ? widgetForegroundOr(roleColor(ColorRole::OnSurface))
|
||||
: roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_label->setColor(m_lastPlaybackStatus == "Playing" ? widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface))
|
||||
: colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_label->measure(renderer);
|
||||
|
||||
if (artChanged) {
|
||||
|
||||
@@ -35,7 +35,7 @@ void NetworkWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph("wifi-off");
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph = glyph.get();
|
||||
area->addChild(std::move(glyph));
|
||||
|
||||
@@ -100,8 +100,8 @@ void NetworkWidget::syncState(Renderer& renderer) {
|
||||
|
||||
m_glyph->setGlyph(NetworkService::glyphForState(s));
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
m_glyph->setColor(s.connected ? widgetForegroundOr(roleColor(ColorRole::OnSurface))
|
||||
: roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_glyph->setColor(s.connected ? widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface))
|
||||
: colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_glyph->measure(renderer);
|
||||
|
||||
if (m_label != nullptr) {
|
||||
@@ -114,8 +114,8 @@ void NetworkWidget::syncState(Renderer& renderer) {
|
||||
}
|
||||
m_label->setFontSize((m_isVertical ? Style::fontSizeCaption : Style::fontSizeBody) * m_contentScale);
|
||||
m_label->setText(text);
|
||||
m_label->setColor(s.connected ? widgetForegroundOr(roleColor(ColorRole::OnSurface))
|
||||
: roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_label->setColor(s.connected ? widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface))
|
||||
: colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_label->measure(renderer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ void NightLightWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph("nightlight-off");
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
glyph->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_glyph = glyph.get();
|
||||
area->addChild(std::move(glyph));
|
||||
|
||||
@@ -89,11 +89,11 @@ void NightLightWidget::syncState(Renderer& renderer) {
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
|
||||
if (forced || (enabled && active)) {
|
||||
m_glyph->setColor(roleColor(ColorRole::Primary));
|
||||
m_glyph->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
} else if (enabled) {
|
||||
m_glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
} else {
|
||||
m_glyph->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_glyph->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
}
|
||||
|
||||
m_glyph->measure(renderer);
|
||||
|
||||
@@ -38,12 +38,12 @@ void NotificationWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph("bell");
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph = glyph.get();
|
||||
area->addChild(std::move(glyph));
|
||||
|
||||
auto dot = std::make_unique<Box>();
|
||||
dot->setFill(roleColor(ColorRole::Primary));
|
||||
dot->setFill(colorSpecFromRole(ColorRole::Primary));
|
||||
const float dotSize = kDotBaseSize * m_contentScale;
|
||||
dot->setRadius(dotSize * 0.5f);
|
||||
dot->setSize(dotSize, dotSize);
|
||||
@@ -64,7 +64,7 @@ void NotificationWidget::doLayout(Renderer& renderer, float /*containerWidth*/,
|
||||
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
m_glyph->setGlyph(m_dndEnabled ? "bell-off" : "bell");
|
||||
m_glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph->measure(renderer);
|
||||
m_glyph->setPosition(0.0f, 0.0f);
|
||||
rootNode->setSize(m_glyph->width(), m_glyph->height());
|
||||
@@ -87,7 +87,7 @@ void NotificationWidget::refreshIndicatorState() {
|
||||
m_dndEnabled = dndEnabled;
|
||||
if (m_glyph != nullptr) {
|
||||
m_glyph->setGlyph(m_dndEnabled ? "bell-off" : "bell");
|
||||
m_glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
}
|
||||
if (m_dot != nullptr) {
|
||||
m_dot->setVisible(m_hasNotifications && !m_dndEnabled);
|
||||
|
||||
@@ -21,7 +21,7 @@ void PowerProfilesWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph("balanced");
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph = glyph.get();
|
||||
area->addChild(std::move(glyph));
|
||||
|
||||
@@ -36,8 +36,8 @@ void PowerProfilesWidget::doLayout(Renderer& renderer, float /*containerWidth*/,
|
||||
syncState(renderer);
|
||||
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
m_glyph->setColor(m_available ? widgetForegroundOr(roleColor(ColorRole::OnSurface))
|
||||
: roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_glyph->setColor(m_available ? widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface))
|
||||
: colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_glyph->measure(renderer);
|
||||
m_glyph->setPosition(0.0f, 0.0f);
|
||||
rootNode->setSize(m_glyph->width(), m_glyph->height());
|
||||
@@ -61,8 +61,8 @@ void PowerProfilesWidget::syncState(Renderer& renderer) {
|
||||
m_lastProfile = profile;
|
||||
|
||||
m_glyph->setGlyph(glyphForProfile(profile));
|
||||
m_glyph->setColor(m_available ? widgetForegroundOr(roleColor(ColorRole::OnSurface))
|
||||
: roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_glyph->setColor(m_available ? widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface))
|
||||
: colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_glyph->measure(renderer);
|
||||
m_area->setEnabled(m_available);
|
||||
if (auto* rootNode = root(); rootNode != nullptr) {
|
||||
|
||||
@@ -143,7 +143,8 @@ void ScriptedWidget::doLayout(Renderer& renderer, float containerWidth, float co
|
||||
if (!m_flex)
|
||||
return;
|
||||
|
||||
auto textColor = m_textColorRole ? roleColor(*m_textColorRole) : widgetForegroundOr(roleColor(ColorRole::OnSurface));
|
||||
auto textColor = m_textColorRole ? colorSpecFromRole(*m_textColorRole)
|
||||
: widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface));
|
||||
m_label->setColor(textColor);
|
||||
m_label->setVisible(!m_label->text().empty());
|
||||
if (m_label->visible()) {
|
||||
@@ -151,8 +152,8 @@ void ScriptedWidget::doLayout(Renderer& renderer, float containerWidth, float co
|
||||
}
|
||||
|
||||
if (m_glyphVisible) {
|
||||
auto glyphColor =
|
||||
m_glyphColorRole ? roleColor(*m_glyphColorRole) : widgetForegroundOr(roleColor(ColorRole::OnSurface));
|
||||
auto glyphColor = m_glyphColorRole ? colorSpecFromRole(*m_glyphColorRole)
|
||||
: widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface));
|
||||
m_glyph->setColor(glyphColor);
|
||||
m_glyph->measure(renderer);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ void SessionWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph(m_barGlyphId.empty() ? "shutdown" : m_barGlyphId);
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph = glyph.get();
|
||||
area->addChild(std::move(glyph));
|
||||
|
||||
@@ -30,7 +30,7 @@ void SessionWidget::doLayout(Renderer& renderer, float /*containerWidth*/, float
|
||||
return;
|
||||
}
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
m_glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph->measure(renderer);
|
||||
auto* node = root();
|
||||
if (node != nullptr) {
|
||||
|
||||
@@ -19,7 +19,7 @@ void SettingsWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph(m_barGlyphId.empty() ? "settings" : m_barGlyphId);
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph = glyph.get();
|
||||
area->addChild(std::move(glyph));
|
||||
|
||||
@@ -31,7 +31,7 @@ void SettingsWidget::doLayout(Renderer& renderer, float /*containerWidth*/, floa
|
||||
return;
|
||||
}
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
m_glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph->measure(renderer);
|
||||
auto* node = root();
|
||||
if (node != nullptr) {
|
||||
|
||||
@@ -69,21 +69,21 @@ void SysmonWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph(glyphName(m_stat));
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph = glyph.get();
|
||||
container->addChild(std::move(glyph));
|
||||
|
||||
if (m_displayMode == SysmonDisplayMode::Graph) {
|
||||
auto chartBg = std::make_unique<RectNode>();
|
||||
RoundedRectStyle bgStyle;
|
||||
bgStyle.fill = resolveColorRole(ColorRole::SurfaceVariant);
|
||||
bgStyle.fill = colorForRole(ColorRole::SurfaceVariant);
|
||||
bgStyle.radius = Style::radiusSm;
|
||||
bgStyle.softness = 0.5f;
|
||||
chartBg->setStyle(bgStyle);
|
||||
m_chartBg = static_cast<RectNode*>(container->addChild(std::move(chartBg)));
|
||||
|
||||
auto graph = std::make_unique<GraphNode>();
|
||||
graph->setLineColor1(resolveColorRole(ColorRole::Primary));
|
||||
graph->setLineColor1(colorForRole(ColorRole::Primary));
|
||||
graph->setLineWidth(kGraphLineWidth * m_contentScale);
|
||||
graph->setGraphFillOpacity(0.15f);
|
||||
m_graphNode = static_cast<GraphNode*>(m_chartBg->addChild(std::move(graph)));
|
||||
@@ -91,8 +91,8 @@ void SysmonWidget::create() {
|
||||
|
||||
if (m_displayMode == SysmonDisplayMode::Gauge) {
|
||||
auto gauge = std::make_unique<ProgressBar>();
|
||||
gauge->setFill(roleColor(ColorRole::Primary));
|
||||
gauge->setTrackColor(roleColor(ColorRole::OnSurface, 0.25f));
|
||||
gauge->setFill(colorSpecFromRole(ColorRole::Primary));
|
||||
gauge->setTrackColor(colorSpecFromRole(ColorRole::OnSurface, 0.25f));
|
||||
gauge->setProgress(0.0f);
|
||||
m_gauge = static_cast<ProgressBar*>(container->addChild(std::move(gauge)));
|
||||
}
|
||||
@@ -144,7 +144,7 @@ void SysmonWidget::doLayout(Renderer& renderer, float containerWidth, float cont
|
||||
const bool orientationChanged = m_isVerticalBar != isVerticalBar;
|
||||
m_isVerticalBar = isVerticalBar;
|
||||
|
||||
m_glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph->measure(renderer);
|
||||
const float glyphH = m_glyph->height();
|
||||
const float gap = Style::spaceXs * m_contentScale;
|
||||
@@ -155,7 +155,7 @@ void SysmonWidget::doLayout(Renderer& renderer, float containerWidth, float cont
|
||||
syncLabelText(m_lastRawValue.empty() ? formatValue() : m_lastRawValue);
|
||||
}
|
||||
m_label->setFontSize((verticalBar ? Style::fontSizeCaption : Style::fontSizeBody) * m_contentScale);
|
||||
m_label->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_label->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_label->measure(renderer);
|
||||
}
|
||||
const float labelW = m_label != nullptr ? m_label->width() : 0.0f;
|
||||
|
||||
@@ -126,7 +126,7 @@ void TaskbarWidget::buildTaskButtons(Renderer& renderer) {
|
||||
|
||||
if (task.active) {
|
||||
auto indicator = std::make_unique<Box>();
|
||||
indicator->setFill(roleColor(ColorRole::Primary));
|
||||
indicator->setFill(colorSpecFromRole(ColorRole::Primary));
|
||||
indicator->setRadius(indicatorSize * 0.5f);
|
||||
indicator->setFrameSize(indicatorSize, indicatorSize);
|
||||
indicator->setPosition(std::round((tileSize - indicatorSize) * 0.5f), std::round(tileSize - indicatorSize));
|
||||
@@ -164,8 +164,8 @@ void TaskbarWidget::buildTaskButtons(Renderer& renderer) {
|
||||
|
||||
auto group = std::make_unique<Box>();
|
||||
group->setFrameSize(groupWidth, groupHeight);
|
||||
group->setFill(roleColor(ColorRole::SurfaceVariant, ws.workspace.active ? 0.52f : 0.18f));
|
||||
group->setBorder(roleColor(ColorRole::Primary, ws.workspace.active ? 0.65f : 0.16f), Style::borderWidth);
|
||||
group->setFill(colorSpecFromRole(ColorRole::SurfaceVariant, ws.workspace.active ? 0.52f : 0.18f));
|
||||
group->setBorder(colorSpecFromRole(ColorRole::Primary, ws.workspace.active ? 0.65f : 0.16f), Style::borderWidth);
|
||||
group->setRadius(capsuleRadius);
|
||||
auto* groupPtr = static_cast<Box*>(m_taskStrip->addChild(std::move(group)));
|
||||
|
||||
@@ -179,8 +179,8 @@ void TaskbarWidget::buildTaskButtons(Renderer& renderer) {
|
||||
auto badge = std::make_unique<Box>();
|
||||
badge->setFrameSize(badgeWidth, badgeBase);
|
||||
badge->setRadius(badgeBase * 0.5f);
|
||||
badge->setFill(roleColor(ws.workspace.active ? ColorRole::Primary : ColorRole::Surface));
|
||||
badge->setBorder(roleColor(ColorRole::Outline, 0.45f), Style::borderWidth);
|
||||
badge->setFill(colorSpecFromRole(ws.workspace.active ? ColorRole::Primary : ColorRole::Surface));
|
||||
badge->setBorder(colorSpecFromRole(ColorRole::Outline, 0.45f), Style::borderWidth);
|
||||
badge->setPosition(std::round(badgeWidth * -0.32f), std::round(badgeBase * -0.22f));
|
||||
auto* badgePtr = static_cast<Box*>(groupPtr->addChild(std::move(badge)));
|
||||
|
||||
@@ -188,7 +188,7 @@ void TaskbarWidget::buildTaskButtons(Renderer& renderer) {
|
||||
badgeText->setText(ws.label);
|
||||
badgeText->setBold(true);
|
||||
badgeText->setFontSize(badgeFontSize);
|
||||
badgeText->setColor(roleColor(ws.workspace.active ? ColorRole::OnPrimary : ColorRole::OnSurface));
|
||||
badgeText->setColor(colorSpecFromRole(ws.workspace.active ? ColorRole::OnPrimary : ColorRole::OnSurface));
|
||||
badgeText->measure(renderer);
|
||||
badgeText->setPosition(std::round((badgeWidth - badgeText->width()) * 0.5f),
|
||||
std::round((badgeBase - badgeText->height()) * 0.5f));
|
||||
|
||||
@@ -17,7 +17,7 @@ void TestWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph("flask");
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph = glyph.get();
|
||||
area->addChild(std::move(glyph));
|
||||
|
||||
@@ -29,7 +29,7 @@ void TestWidget::doLayout(Renderer& renderer, float /*containerWidth*/, float /*
|
||||
return;
|
||||
}
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
m_glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph->measure(renderer);
|
||||
auto* node = root();
|
||||
if (node != nullptr) {
|
||||
|
||||
@@ -27,8 +27,8 @@ void ThemeModeWidget::create() {
|
||||
m_lastIsLight = !m_lastIsLight;
|
||||
if (m_glyph != nullptr) {
|
||||
m_glyph->setGlyph(glyphForMode(m_lastIsLight));
|
||||
m_glyph->setColor(m_lastIsLight ? roleColor(ColorRole::Primary)
|
||||
: widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(m_lastIsLight ? colorSpecFromRole(ColorRole::Primary)
|
||||
: widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
}
|
||||
requestRedraw();
|
||||
});
|
||||
@@ -37,7 +37,7 @@ void ThemeModeWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph("theme-mode");
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph = glyph.get();
|
||||
area->addChild(std::move(glyph));
|
||||
|
||||
@@ -51,8 +51,8 @@ void ThemeModeWidget::doLayout(Renderer& renderer, float /*containerWidth*/, flo
|
||||
|
||||
syncState(renderer);
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
m_glyph->setColor(m_lastIsLight ? roleColor(ColorRole::Primary)
|
||||
: widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(m_lastIsLight ? colorSpecFromRole(ColorRole::Primary)
|
||||
: widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph->measure(renderer);
|
||||
|
||||
if (auto* node = root(); node != nullptr) {
|
||||
@@ -74,7 +74,8 @@ void ThemeModeWidget::syncState(Renderer& renderer) {
|
||||
|
||||
m_lastIsLight = isLight;
|
||||
m_glyph->setGlyph(glyphForMode(isLight));
|
||||
m_glyph->setColor(isLight ? roleColor(ColorRole::Primary) : widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(isLight ? colorSpecFromRole(ColorRole::Primary)
|
||||
: widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
m_glyph->measure(renderer);
|
||||
|
||||
|
||||
@@ -483,8 +483,8 @@ void TrayWidget::rebuild(Renderer& renderer) {
|
||||
const std::string fallback = iconForItem(item);
|
||||
glyph->setGlyph(fallback);
|
||||
glyph->setGlyphSize(iconSize);
|
||||
glyph->setColor(item.needsAttention ? roleColor(ColorRole::Error)
|
||||
: widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
glyph->setColor(item.needsAttention ? colorSpecFromRole(ColorRole::Error)
|
||||
: widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
glyph->measure(renderer);
|
||||
iconW = glyph->width();
|
||||
iconH = glyph->height();
|
||||
|
||||
@@ -51,7 +51,7 @@ void VolumeWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph("volume-high");
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph = glyph.get();
|
||||
area->addChild(std::move(glyph));
|
||||
|
||||
@@ -117,8 +117,8 @@ void VolumeWidget::syncState(Renderer& renderer) {
|
||||
|
||||
m_glyph->setGlyph(volumeGlyphName(volume, muted));
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
m_glyph->setColor(muted ? roleColor(ColorRole::OnSurfaceVariant)
|
||||
: widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(muted ? colorSpecFromRole(ColorRole::OnSurfaceVariant)
|
||||
: widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph->measure(renderer);
|
||||
|
||||
m_label->setVisible(m_showLabel);
|
||||
@@ -126,8 +126,8 @@ void VolumeWidget::syncState(Renderer& renderer) {
|
||||
int pct = static_cast<int>(std::round(volume * 100.0f));
|
||||
m_label->setFontSize((m_isVertical ? Style::fontSizeCaption : Style::fontSizeBody) * m_contentScale);
|
||||
m_label->setText(m_isVertical ? std::to_string(pct) : std::to_string(pct) + "%");
|
||||
m_label->setColor(muted ? roleColor(ColorRole::OnSurfaceVariant)
|
||||
: widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_label->setColor(muted ? colorSpecFromRole(ColorRole::OnSurfaceVariant)
|
||||
: widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_label->measure(renderer);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ void WallpaperWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph(m_barGlyphId.empty() ? "wallpaper-selector" : m_barGlyphId);
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph = glyph.get();
|
||||
area->addChild(std::move(glyph));
|
||||
|
||||
@@ -30,7 +30,7 @@ void WallpaperWidget::doLayout(Renderer& renderer, float /*containerWidth*/, flo
|
||||
return;
|
||||
}
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
m_glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph->measure(renderer);
|
||||
if (auto* node = root(); node != nullptr) {
|
||||
node->setSize(m_glyph->width(), m_glyph->height());
|
||||
|
||||
@@ -25,7 +25,7 @@ void WeatherWidget::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph("weather-cloud");
|
||||
glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph = glyph.get();
|
||||
area->addChild(std::move(glyph));
|
||||
|
||||
@@ -47,11 +47,11 @@ void WeatherWidget::doLayout(Renderer& renderer, float containerWidth, float con
|
||||
sync(renderer);
|
||||
|
||||
m_glyph->setGlyphSize(Style::barGlyphSize * m_contentScale);
|
||||
m_glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph->measure(renderer);
|
||||
m_label->setTextAlign(m_isVertical ? TextAlign::Center : TextAlign::Start);
|
||||
m_label->setMaxWidth(m_isVertical ? containerWidth : (m_maxWidth * m_contentScale));
|
||||
m_label->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_label->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_label->measure(renderer);
|
||||
|
||||
const float spacing = m_label->text().empty() ? 0.0f : (Style::spaceXs * m_contentScale);
|
||||
@@ -113,7 +113,7 @@ void WeatherWidget::sync(Renderer& renderer) {
|
||||
if (glyph != m_lastGlyph) {
|
||||
m_lastGlyph = glyph;
|
||||
m_glyph->setGlyph(glyph);
|
||||
m_glyph->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_glyph->measure(renderer);
|
||||
changed = true;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ void WeatherWidget::sync(Renderer& renderer) {
|
||||
if (text != m_lastText) {
|
||||
m_lastText = text;
|
||||
m_label->setText(text);
|
||||
m_label->setColor(widgetForegroundOr(roleColor(ColorRole::OnSurface)));
|
||||
m_label->setColor(widgetForegroundOr(colorSpecFromRole(ColorRole::OnSurface)));
|
||||
m_label->measure(renderer);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ void WorkspacesWidget::rebuild(Renderer& renderer) {
|
||||
indicator->clearBorder();
|
||||
indicator->setRadius(indicatorHeight * 0.5f);
|
||||
indicator->setFrameSize(w, indicatorHeight);
|
||||
indicator->setFill(roleColor(workspaceFillRole(ws)));
|
||||
indicator->setFill(colorSpecFromRole(workspaceFillRole(ws)));
|
||||
item.indicator = static_cast<Box*>(area->addChild(std::move(indicator)));
|
||||
|
||||
if (showLabel) {
|
||||
@@ -216,7 +216,7 @@ void WorkspacesWidget::rebuild(Renderer& renderer) {
|
||||
text->setText(labels[i]);
|
||||
text->setFontSize(labelFontSize);
|
||||
text->setBold(true);
|
||||
text->setColor(roleColor(workspaceTextRole(ws)));
|
||||
text->setColor(colorSpecFromRole(workspaceTextRole(ws)));
|
||||
text->measure(renderer);
|
||||
item.label = labels[i];
|
||||
item.text = static_cast<Label*>(area->addChild(std::move(text)));
|
||||
@@ -282,10 +282,10 @@ void WorkspacesWidget::retarget(Renderer& renderer) {
|
||||
for (std::size_t i = 0; i < m_items.size(); ++i) {
|
||||
auto& it = m_items[i];
|
||||
if (it.indicator != nullptr) {
|
||||
it.indicator->setFill(roleColor(workspaceFillRole(m_cachedState[i])));
|
||||
it.indicator->setFill(colorSpecFromRole(workspaceFillRole(m_cachedState[i])));
|
||||
}
|
||||
if (it.text != nullptr) {
|
||||
it.text->setColor(roleColor(workspaceTextRole(m_cachedState[i])));
|
||||
it.text->setColor(colorSpecFromRole(workspaceTextRole(m_cachedState[i])));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ void ClipboardPanel::create() {
|
||||
title->setText(i18n::tr("clipboard.title"));
|
||||
title->setFontSize(Style::fontSizeTitle * scale);
|
||||
title->setBold(true);
|
||||
title->setColor(roleColor(ColorRole::Primary));
|
||||
title->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
m_sidebarTitle = title.get();
|
||||
sidebarHeader->addChild(std::move(title));
|
||||
|
||||
@@ -208,7 +208,7 @@ void ClipboardPanel::create() {
|
||||
previewTitleLabel->setText(i18n::tr("clipboard.entry.title"));
|
||||
previewTitleLabel->setFontSize(Style::fontSizeTitle * scale);
|
||||
previewTitleLabel->setBold(true);
|
||||
previewTitleLabel->setColor(roleColor(ColorRole::Primary));
|
||||
previewTitleLabel->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
m_previewTitle = previewTitleLabel.get();
|
||||
previewTitleLabel->setFlexGrow(1.0f);
|
||||
previewHeader->addChild(std::move(previewTitleLabel));
|
||||
@@ -229,7 +229,7 @@ void ClipboardPanel::create() {
|
||||
auto previewMetaLabel = std::make_unique<Label>();
|
||||
previewMetaLabel->setCaptionStyle();
|
||||
previewMetaLabel->setFontSize(Style::fontSizeCaption * scale);
|
||||
previewMetaLabel->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
previewMetaLabel->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_previewMeta = previewMetaLabel.get();
|
||||
preview->addChild(std::move(previewMetaLabel));
|
||||
|
||||
@@ -432,7 +432,7 @@ void ClipboardPanel::rebuildList(Renderer& renderer, float width) {
|
||||
: m_filterQuery.empty() ? i18n::tr("clipboard.empty.history-title")
|
||||
: i18n::tr("clipboard.empty.no-matches-title"));
|
||||
empty->setCaptionStyle();
|
||||
empty->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
empty->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
empty->setMaxWidth(width);
|
||||
m_list->addChild(std::move(empty));
|
||||
m_lastChangeSerial = m_clipboard != nullptr ? m_clipboard->changeSerial() : 0;
|
||||
@@ -454,7 +454,7 @@ void ClipboardPanel::rebuildList(Renderer& renderer, float width) {
|
||||
row->setMinHeight(kRowHeight);
|
||||
row->setRadius(Style::radiusMd);
|
||||
if (i == m_selectedIndex) {
|
||||
row->setFill(roleColor(ColorRole::SurfaceVariant));
|
||||
row->setFill(colorSpecFromRole(ColorRole::SurfaceVariant));
|
||||
}
|
||||
|
||||
auto* rowPtr = row.get();
|
||||
@@ -472,7 +472,7 @@ void ClipboardPanel::rebuildList(Renderer& renderer, float width) {
|
||||
m_mouseActive = true;
|
||||
if (idx != m_selectedIndex && m_hoverIndex != idx) {
|
||||
m_hoverIndex = idx;
|
||||
rowPtr->setFill(roleColor(ColorRole::SurfaceVariant, 0.45f));
|
||||
rowPtr->setFill(colorSpecFromRole(ColorRole::SurfaceVariant, 0.45f));
|
||||
PanelManager::instance().refresh();
|
||||
}
|
||||
}
|
||||
@@ -482,7 +482,7 @@ void ClipboardPanel::rebuildList(Renderer& renderer, float width) {
|
||||
return;
|
||||
}
|
||||
m_hoverIndex = idx;
|
||||
rowPtr->setFill(roleColor(ColorRole::SurfaceVariant, 0.45f));
|
||||
rowPtr->setFill(colorSpecFromRole(ColorRole::SurfaceVariant, 0.45f));
|
||||
PanelManager::instance().refresh();
|
||||
});
|
||||
area->setOnLeave([this, idx = i, rowPtr]() {
|
||||
@@ -497,7 +497,7 @@ void ClipboardPanel::rebuildList(Renderer& renderer, float width) {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph(entry.isImage() ? "photo" : "file-text");
|
||||
glyph->setGlyphSize(kListGlyphSize);
|
||||
glyph->setColor(roleColor(entry.isImage() ? ColorRole::Secondary : ColorRole::Primary));
|
||||
glyph->setColor(colorSpecFromRole(entry.isImage() ? ColorRole::Secondary : ColorRole::Primary));
|
||||
row->addChild(std::move(glyph));
|
||||
|
||||
auto textColumn = std::make_unique<Flex>();
|
||||
@@ -511,7 +511,7 @@ void ClipboardPanel::rebuildList(Renderer& renderer, float width) {
|
||||
title->setText(cleanTitle);
|
||||
title->setFontSize(Style::fontSizeBody);
|
||||
title->setBold(true);
|
||||
title->setColor(roleColor(ColorRole::OnSurface));
|
||||
title->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
title->setMaxWidth(textWidth);
|
||||
title->setMaxLines(1);
|
||||
textColumn->addChild(std::move(title));
|
||||
@@ -519,7 +519,7 @@ void ClipboardPanel::rebuildList(Renderer& renderer, float width) {
|
||||
auto timeLabel = std::make_unique<Label>();
|
||||
timeLabel->setText(formatTimeAgo(entry.capturedAt) + " • " + formatBytes(entry.byteSize));
|
||||
timeLabel->setCaptionStyle();
|
||||
timeLabel->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
timeLabel->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
timeLabel->setMaxWidth(textWidth);
|
||||
textColumn->addChild(std::move(timeLabel));
|
||||
|
||||
@@ -557,7 +557,7 @@ void ClipboardPanel::rebuildPreview(Renderer& renderer, float width, float heigh
|
||||
auto empty = std::make_unique<Label>();
|
||||
empty->setText(history.empty() ? i18n::tr("clipboard.empty.history-message")
|
||||
: i18n::tr("clipboard.empty.no-matches-message"));
|
||||
empty->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
empty->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
empty->setMaxWidth(width);
|
||||
m_previewContent->addChild(std::move(empty));
|
||||
m_lastPreviewWidth = width;
|
||||
@@ -574,7 +574,7 @@ void ClipboardPanel::rebuildPreview(Renderer& renderer, float width, float heigh
|
||||
if (m_previewPayloadIndex != historyIndex) {
|
||||
auto pending = std::make_unique<Label>();
|
||||
pending->setText(i18n::tr("clipboard.preview.loading"));
|
||||
pending->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
pending->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
pending->setMaxWidth(width);
|
||||
m_previewContent->addChild(std::move(pending));
|
||||
m_lastPreviewWidth = width;
|
||||
@@ -621,13 +621,13 @@ void ClipboardPanel::rebuildPreview(Renderer& renderer, float width, float heigh
|
||||
if (expanded.empty()) {
|
||||
auto empty = std::make_unique<Label>();
|
||||
empty->setText(i18n::tr("clipboard.preview.empty-text-payload"));
|
||||
empty->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
empty->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_previewContent->addChild(std::move(empty));
|
||||
} else {
|
||||
auto label = std::make_unique<Label>();
|
||||
label->setText(expanded);
|
||||
label->setFontSize(Style::fontSizeBody);
|
||||
label->setColor(roleColor(ColorRole::OnSurface));
|
||||
label->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
label->setMaxWidth(width);
|
||||
label->setMaxLines(kMaxPreviewLines);
|
||||
m_previewContent->addChild(std::move(label));
|
||||
@@ -635,7 +635,7 @@ void ClipboardPanel::rebuildPreview(Renderer& renderer, float width, float heigh
|
||||
auto hint = std::make_unique<Label>();
|
||||
hint->setText(i18n::tr("clipboard.preview.truncated"));
|
||||
hint->setCaptionStyle();
|
||||
hint->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
hint->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_previewContent->addChild(std::move(hint));
|
||||
}
|
||||
}
|
||||
@@ -711,13 +711,13 @@ void ClipboardPanel::updateRowSelection(std::size_t previousIndex) {
|
||||
if (previousIndex < m_rowFlexes.size() && m_rowFlexes[previousIndex] != nullptr) {
|
||||
Flex* prev = m_rowFlexes[previousIndex];
|
||||
if (m_hoverIndex == previousIndex) {
|
||||
prev->setFill(roleColor(ColorRole::SurfaceVariant, 0.45f));
|
||||
prev->setFill(colorSpecFromRole(ColorRole::SurfaceVariant, 0.45f));
|
||||
} else {
|
||||
prev->setFill(rgba(0, 0, 0, 0));
|
||||
}
|
||||
}
|
||||
if (m_selectedIndex < m_rowFlexes.size() && m_rowFlexes[m_selectedIndex] != nullptr) {
|
||||
m_rowFlexes[m_selectedIndex]->setFill(roleColor(ColorRole::SurfaceVariant));
|
||||
m_rowFlexes[m_selectedIndex]->setFill(colorSpecFromRole(ColorRole::SurfaceVariant));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -471,7 +471,7 @@ namespace {
|
||||
setPadding(Style::spaceSm, Style::spaceMd);
|
||||
setMinHeight(Style::controlHeightLg);
|
||||
setRadius(Style::radiusMd);
|
||||
setFill(roleColor(ColorRole::Surface));
|
||||
setFill(colorSpecFromRole(ColorRole::Surface));
|
||||
clearBorder();
|
||||
|
||||
auto radio = std::make_unique<RadioButton>();
|
||||
@@ -485,7 +485,7 @@ namespace {
|
||||
auto title = std::make_unique<Label>();
|
||||
title->setBold(true);
|
||||
title->setFontSize(Style::fontSizeBody);
|
||||
title->setColor(roleColor(ColorRole::OnSurface));
|
||||
title->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
title->setFlexGrow(1.0f);
|
||||
m_title = title.get();
|
||||
addChild(std::move(title));
|
||||
@@ -545,22 +545,22 @@ namespace {
|
||||
private:
|
||||
void applyState() {
|
||||
if (pressed()) {
|
||||
setFill(roleColor(ColorRole::Primary));
|
||||
setBorder(roleColor(ColorRole::Primary), Style::borderWidth);
|
||||
setFill(colorSpecFromRole(ColorRole::Primary));
|
||||
setBorder(colorSpecFromRole(ColorRole::Primary), Style::borderWidth);
|
||||
if (m_title != nullptr) {
|
||||
m_title->setColor(roleColor(ColorRole::OnPrimary));
|
||||
m_title->setColor(colorSpecFromRole(ColorRole::OnPrimary));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
setFill(roleColor(ColorRole::Surface));
|
||||
setFill(colorSpecFromRole(ColorRole::Surface));
|
||||
if (hovered()) {
|
||||
setBorder(roleColor(ColorRole::Primary), Style::borderWidth);
|
||||
setBorder(colorSpecFromRole(ColorRole::Primary), Style::borderWidth);
|
||||
} else {
|
||||
clearBorder();
|
||||
}
|
||||
if (m_title != nullptr) {
|
||||
m_title->setColor(roleColor(ColorRole::OnSurface));
|
||||
m_title->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -587,7 +587,7 @@ namespace {
|
||||
setPadding(Style::spaceXs * scale, Style::spaceMd * scale);
|
||||
setMinHeight((Style::controlHeightLg + Style::spaceXs) * scale);
|
||||
setRadius(Style::radiusMd * scale);
|
||||
setFill(roleColor(ColorRole::Surface));
|
||||
setFill(colorSpecFromRole(ColorRole::Surface));
|
||||
clearBorder();
|
||||
|
||||
constexpr float kIconSizeSm = 28.0f;
|
||||
@@ -618,14 +618,14 @@ namespace {
|
||||
auto appName = std::make_unique<Label>();
|
||||
appName->setBold(true);
|
||||
appName->setFontSize(Style::fontSizeBody * scale);
|
||||
appName->setColor(roleColor(ColorRole::OnSurface));
|
||||
appName->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
m_appNameLabel = appName.get();
|
||||
textCol->addChild(std::move(appName));
|
||||
|
||||
auto subtitle = std::make_unique<Label>();
|
||||
subtitle->setCaptionStyle();
|
||||
subtitle->setFontSize(Style::fontSizeCaption * scale);
|
||||
subtitle->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
subtitle->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
subtitle->setVisible(false);
|
||||
m_subtitleLabel = subtitle.get();
|
||||
textCol->addChild(std::move(subtitle));
|
||||
@@ -910,21 +910,21 @@ namespace {
|
||||
card->setGap(Style::spaceXs * scale);
|
||||
card->setPadding(Style::spaceMd * scale);
|
||||
card->setRadius(Style::radiusMd * scale);
|
||||
card->setFill(roleColor(ColorRole::Surface));
|
||||
card->setFill(colorSpecFromRole(ColorRole::Surface));
|
||||
card->clearBorder();
|
||||
|
||||
auto titleLabel = std::make_unique<Label>();
|
||||
titleLabel->setText(title);
|
||||
titleLabel->setBold(true);
|
||||
titleLabel->setFontSize(Style::fontSizeBody * scale);
|
||||
titleLabel->setColor(roleColor(ColorRole::OnSurface));
|
||||
titleLabel->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
card->addChild(std::move(titleLabel));
|
||||
|
||||
auto bodyLabel = std::make_unique<Label>();
|
||||
bodyLabel->setText(body);
|
||||
bodyLabel->setCaptionStyle();
|
||||
bodyLabel->setFontSize(Style::fontSizeCaption * scale);
|
||||
bodyLabel->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
bodyLabel->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
card->addChild(std::move(bodyLabel));
|
||||
|
||||
parent.addChild(std::move(card));
|
||||
@@ -1068,7 +1068,7 @@ std::unique_ptr<Flex> AudioTab::create() {
|
||||
outputDeviceLabel->setText(i18n::tr("control-center.audio.no-output-selected"));
|
||||
outputDeviceLabel->setCaptionStyle();
|
||||
outputDeviceLabel->setFontSize(Style::fontSizeCaption * scale);
|
||||
outputDeviceLabel->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
outputDeviceLabel->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_outputDeviceLabel = outputDeviceLabel.get();
|
||||
|
||||
auto outputMenuButton = std::make_unique<Button>();
|
||||
@@ -1172,7 +1172,7 @@ std::unique_ptr<Flex> AudioTab::create() {
|
||||
inputDeviceLabel->setText(i18n::tr("control-center.audio.no-input-selected"));
|
||||
inputDeviceLabel->setCaptionStyle();
|
||||
inputDeviceLabel->setFontSize(Style::fontSizeCaption * scale);
|
||||
inputDeviceLabel->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
inputDeviceLabel->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_inputDeviceLabel = inputDeviceLabel.get();
|
||||
|
||||
auto inputMenuButton = std::make_unique<Button>();
|
||||
|
||||
@@ -85,20 +85,20 @@ namespace {
|
||||
setPadding(Style::spaceSm * scale, Style::spaceMd * scale);
|
||||
setMinHeight(kRowMinHeight * scale);
|
||||
setRadius(Style::radiusMd * scale);
|
||||
setFill(roleColor(ColorRole::Surface));
|
||||
setFill(colorSpecFromRole(ColorRole::Surface));
|
||||
clearBorder();
|
||||
|
||||
auto icon = std::make_unique<Glyph>();
|
||||
icon->setGlyph(glyphFor(m_device.kind));
|
||||
icon->setGlyphSize(Style::fontSizeBody * scale);
|
||||
icon->setColor(roleColor(ColorRole::OnSurface));
|
||||
icon->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
addChild(std::move(icon));
|
||||
|
||||
auto alias = std::make_unique<Label>();
|
||||
alias->setText(m_device.alias);
|
||||
alias->setBold(m_device.connected);
|
||||
alias->setFontSize(Style::fontSizeBody * scale);
|
||||
alias->setColor(roleColor(ColorRole::OnSurface));
|
||||
alias->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
alias->setFlexGrow(1.0f);
|
||||
m_title = alias.get();
|
||||
addChild(std::move(alias));
|
||||
@@ -108,14 +108,14 @@ namespace {
|
||||
battery->setText(std::to_string(static_cast<int>(m_device.batteryPercent)) + "%");
|
||||
battery->setCaptionStyle();
|
||||
battery->setFontSize(Style::fontSizeCaption * scale);
|
||||
battery->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
battery->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
addChild(std::move(battery));
|
||||
} else if (m_device.hasRssi && bucketFor(m_device) == DeviceBucket::Available) {
|
||||
auto rssi = std::make_unique<Label>();
|
||||
rssi->setText(std::to_string(static_cast<int>(m_device.rssi)) + " dBm");
|
||||
rssi->setCaptionStyle();
|
||||
rssi->setFontSize(Style::fontSizeCaption * scale);
|
||||
rssi->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
rssi->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
addChild(std::move(rssi));
|
||||
}
|
||||
|
||||
@@ -212,21 +212,21 @@ std::unique_ptr<Flex> BluetoothTab::create() {
|
||||
auto pairingTitle = std::make_unique<Label>();
|
||||
pairingTitle->setBold(true);
|
||||
pairingTitle->setFontSize(Style::fontSizeBody * scale);
|
||||
pairingTitle->setColor(roleColor(ColorRole::OnSurface));
|
||||
pairingTitle->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
m_pairingTitle = pairingTitle.get();
|
||||
pairingCard->addChild(std::move(pairingTitle));
|
||||
|
||||
auto pairingDetail = std::make_unique<Label>();
|
||||
pairingDetail->setCaptionStyle();
|
||||
pairingDetail->setFontSize(Style::fontSizeCaption * scale);
|
||||
pairingDetail->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
pairingDetail->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_pairingDetail = pairingDetail.get();
|
||||
pairingCard->addChild(std::move(pairingDetail));
|
||||
|
||||
auto pairingCode = std::make_unique<Label>();
|
||||
pairingCode->setBold(true);
|
||||
pairingCode->setFontSize(Style::fontSizeTitle * scale);
|
||||
pairingCode->setColor(roleColor(ColorRole::Primary));
|
||||
pairingCode->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
m_pairingCode = pairingCode.get();
|
||||
pairingCard->addChild(std::move(pairingCode));
|
||||
|
||||
@@ -354,7 +354,7 @@ std::unique_ptr<Flex> BluetoothTab::createHeaderActions() {
|
||||
auto powerLabel = std::make_unique<Label>();
|
||||
powerLabel->setText(i18n::tr("control-center.bluetooth.bluetooth"));
|
||||
powerLabel->setFontSize(Style::fontSizeCaption * scale);
|
||||
powerLabel->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
powerLabel->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
row->addChild(std::move(powerLabel));
|
||||
|
||||
auto powerToggle = std::make_unique<Toggle>();
|
||||
@@ -371,7 +371,7 @@ std::unique_ptr<Flex> BluetoothTab::createHeaderActions() {
|
||||
auto discoverLabel = std::make_unique<Label>();
|
||||
discoverLabel->setText(i18n::tr("control-center.bluetooth.visible"));
|
||||
discoverLabel->setFontSize(Style::fontSizeCaption * scale);
|
||||
discoverLabel->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
discoverLabel->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
row->addChild(std::move(discoverLabel));
|
||||
|
||||
auto discoverToggle = std::make_unique<Toggle>();
|
||||
@@ -387,7 +387,7 @@ std::unique_ptr<Flex> BluetoothTab::createHeaderActions() {
|
||||
|
||||
auto spinner = std::make_unique<Spinner>();
|
||||
spinner->setSpinnerSize(Style::fontSizeBody * scale);
|
||||
spinner->setColor(roleColor(ColorRole::Primary));
|
||||
spinner->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
m_scanSpinner = spinner.get();
|
||||
row->addChild(std::move(spinner));
|
||||
|
||||
@@ -611,7 +611,7 @@ void BluetoothTab::rebuildDeviceList(Renderer& renderer) {
|
||||
empty->setText(i18n::tr("control-center.bluetooth.unavailable"));
|
||||
empty->setCaptionStyle();
|
||||
empty->setFontSize(Style::fontSizeCaption);
|
||||
empty->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
empty->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_list->addChild(std::move(empty));
|
||||
m_list->layout(renderer);
|
||||
return;
|
||||
@@ -640,7 +640,7 @@ void BluetoothTab::rebuildDeviceList(Renderer& renderer) {
|
||||
: i18n::tr("control-center.bluetooth.off"));
|
||||
empty->setCaptionStyle();
|
||||
empty->setFontSize(Style::fontSizeCaption);
|
||||
empty->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
empty->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_list->addChild(std::move(empty));
|
||||
m_list->layout(renderer);
|
||||
return;
|
||||
@@ -668,7 +668,7 @@ void BluetoothTab::rebuildDeviceList(Renderer& renderer) {
|
||||
header->setCaptionStyle();
|
||||
header->setBold(true);
|
||||
header->setFontSize(Style::fontSizeCaption);
|
||||
header->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
header->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_list->addChild(std::move(header));
|
||||
currentBucket = bucket;
|
||||
first = false;
|
||||
|
||||
@@ -154,7 +154,7 @@ std::unique_ptr<Flex> CalendarTab::create() {
|
||||
month->setBold(true);
|
||||
month->setFontSize((Style::fontSizeTitle + Style::spaceXs) * scale);
|
||||
month->setMaxLines(1);
|
||||
month->setColor(roleColor(ColorRole::OnSurface));
|
||||
month->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
m_monthLabel = month.get();
|
||||
monthWrap->addChild(std::move(month));
|
||||
|
||||
@@ -162,7 +162,7 @@ std::unique_ptr<Flex> CalendarTab::create() {
|
||||
monthSub->setText(i18n::tr("control-center.calendar.today"));
|
||||
monthSub->setCaptionStyle();
|
||||
monthSub->setFontSize(Style::fontSizeCaption * scale);
|
||||
monthSub->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
monthSub->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
monthSub->setMaxLines(1);
|
||||
m_monthSubLabel = monthSub.get();
|
||||
monthWrap->addChild(std::move(monthSub));
|
||||
@@ -207,13 +207,13 @@ std::unique_ptr<Flex> CalendarTab::create() {
|
||||
tasksTitle->setText(i18n::tr("control-center.calendar.tasks"));
|
||||
tasksTitle->setBold(true);
|
||||
tasksTitle->setFontSize(Style::fontSizeTitle * scale);
|
||||
tasksTitle->setColor(roleColor(ColorRole::OnSurface));
|
||||
tasksTitle->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
tasksCard->addChild(std::move(tasksTitle));
|
||||
|
||||
auto tasksBody = std::make_unique<Label>();
|
||||
tasksBody->setText(i18n::tr("control-center.calendar.no-tasks"));
|
||||
tasksBody->setFontSize(Style::fontSizeBody * scale);
|
||||
tasksBody->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
tasksBody->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
tasksBody->setMaxLines(3);
|
||||
tasksCard->addChild(std::move(tasksBody));
|
||||
|
||||
@@ -357,7 +357,7 @@ void CalendarTab::rebuild() {
|
||||
dayLabel->setFontSize((Style::fontSizeCaption + 1.0f) * scale);
|
||||
dayLabel->setBold(true);
|
||||
dayLabel->setStableBaseline(true);
|
||||
dayLabel->setColor(roleColor(i >= 5 ? ColorRole::Secondary : ColorRole::OnSurfaceVariant));
|
||||
dayLabel->setColor(colorSpecFromRole(i >= 5 ? ColorRole::Secondary : ColorRole::OnSurfaceVariant));
|
||||
dayCell->addChild(std::move(dayLabel));
|
||||
|
||||
weekdayRow->addChild(std::move(dayCell));
|
||||
@@ -398,17 +398,17 @@ void CalendarTab::rebuild() {
|
||||
if (index < firstWeekdayMonBased) {
|
||||
const int leadingDay = previousMonthDays - firstWeekdayMonBased + index + 1;
|
||||
dayButton->setText(std::to_string(leadingDay));
|
||||
dayButton->label()->setColor(roleColor(ColorRole::OnSurfaceVariant, 0.75f));
|
||||
dayButton->label()->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant, 0.75f));
|
||||
} else if (day > monthDays) {
|
||||
dayButton->setText(std::to_string(trailingDay));
|
||||
dayButton->label()->setColor(roleColor(ColorRole::OnSurfaceVariant, 0.75f));
|
||||
dayButton->label()->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant, 0.75f));
|
||||
++trailingDay;
|
||||
} else {
|
||||
dayButton->setText(std::to_string(day));
|
||||
if (state.isCurrentMonth && day == state.today) {
|
||||
dayButton->setVariant(ButtonVariant::Accent);
|
||||
} else {
|
||||
dayButton->label()->setColor(roleColor(ColorRole::OnSurface));
|
||||
dayButton->label()->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
}
|
||||
++day;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ void ControlCenterPanel::create() {
|
||||
sidebar->setGap(Style::spaceXs * scale);
|
||||
sidebar->setPadding(Style::spaceSm * scale);
|
||||
sidebar->setFillHeight(true);
|
||||
sidebar->setFill(roleColor(ColorRole::Surface));
|
||||
sidebar->setFill(colorSpecFromRole(ColorRole::Surface));
|
||||
sidebar->setRadius(Style::radiusXl * scale);
|
||||
m_sidebar = sidebar.get();
|
||||
|
||||
@@ -122,7 +122,7 @@ void ControlCenterPanel::create() {
|
||||
title->setText(i18n::tr("control-center.tabs.overview"));
|
||||
title->setBold(true);
|
||||
title->setFontSize(Style::fontSizeTitle * scale);
|
||||
title->setColor(roleColor(ColorRole::Primary));
|
||||
title->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
title->setFlexGrow(1.0f);
|
||||
m_contentTitle = title.get();
|
||||
header->addChild(std::move(title));
|
||||
|
||||
@@ -84,7 +84,7 @@ std::unique_ptr<Flex> DisplayTab::create() {
|
||||
auto emptyLabel = std::make_unique<Label>();
|
||||
emptyLabel->setText(i18n::tr("control-center.display.no-displays"));
|
||||
emptyLabel->setFontSize(Style::fontSizeBody * scale);
|
||||
emptyLabel->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
emptyLabel->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
emptyState->addChild(std::move(emptyLabel));
|
||||
m_emptyState = emptyState.get();
|
||||
tab->addChild(std::move(emptyState));
|
||||
@@ -245,7 +245,7 @@ void DisplayTab::rebuildCards(Renderer& /*renderer*/) {
|
||||
auto icon = std::make_unique<Glyph>();
|
||||
icon->setGlyph("device-desktop");
|
||||
icon->setGlyphSize(Style::fontSizeTitle * scale);
|
||||
icon->setColor(roleColor(ColorRole::OnSurface));
|
||||
icon->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
auto* iconPtr = icon.get();
|
||||
headerRow->addChild(std::move(icon));
|
||||
|
||||
@@ -253,7 +253,7 @@ void DisplayTab::rebuildCards(Renderer& /*renderer*/) {
|
||||
nameLabel->setText(display.label);
|
||||
nameLabel->setBold(true);
|
||||
nameLabel->setFontSize(Style::fontSizeBody * scale);
|
||||
nameLabel->setColor(roleColor(ColorRole::OnSurface));
|
||||
nameLabel->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
nameLabel->setFlexGrow(1.0f);
|
||||
auto* nameLabelPtr = nameLabel.get();
|
||||
headerRow->addChild(std::move(nameLabel));
|
||||
@@ -264,7 +264,7 @@ void DisplayTab::rebuildCards(Renderer& /*renderer*/) {
|
||||
const std::string infoText = formatDisplayInfo(display);
|
||||
detailsLabel->setText(infoText);
|
||||
detailsLabel->setFontSize(Style::fontSizeCaption * scale);
|
||||
detailsLabel->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
detailsLabel->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
auto* detailsLabelPtr = detailsLabel.get();
|
||||
card->addChild(std::move(detailsLabel));
|
||||
|
||||
@@ -277,7 +277,7 @@ void DisplayTab::rebuildCards(Renderer& /*renderer*/) {
|
||||
auto sunIcon = std::make_unique<Glyph>();
|
||||
sunIcon->setGlyph("brightness-low");
|
||||
sunIcon->setGlyphSize(Style::fontSizeTitle * scale);
|
||||
sunIcon->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
sunIcon->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
sliderRow->addChild(std::move(sunIcon));
|
||||
|
||||
auto slider = std::make_unique<Slider>();
|
||||
@@ -317,13 +317,13 @@ void DisplayTab::rebuildCards(Renderer& /*renderer*/) {
|
||||
auto sunHighIcon = std::make_unique<Glyph>();
|
||||
sunHighIcon->setGlyph("brightness-high");
|
||||
sunHighIcon->setGlyphSize(Style::fontSizeTitle * scale);
|
||||
sunHighIcon->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
sunHighIcon->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
sliderRow->addChild(std::move(sunHighIcon));
|
||||
|
||||
auto valueLabel = std::make_unique<Label>();
|
||||
valueLabel->setText(formatBrightnessValue(display, display.brightness));
|
||||
valueLabel->setFontSize(Style::fontSizeBody * scale);
|
||||
valueLabel->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
valueLabel->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
valueLabel->setMinWidth(Style::controlHeightLg * scale);
|
||||
auto* valueLabelPtr = valueLabel.get();
|
||||
sliderRow->addChild(std::move(valueLabel));
|
||||
|
||||
@@ -163,7 +163,7 @@ std::unique_ptr<Flex> MediaTab::create() {
|
||||
nowLabel->setText(i18n::tr("control-center.media.now-playing"));
|
||||
nowLabel->setBold(true);
|
||||
nowLabel->setFontSize(Style::fontSizeTitle * scale);
|
||||
nowLabel->setColor(roleColor(ColorRole::OnSurface));
|
||||
nowLabel->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
nowLabel->setFlexGrow(1.0f);
|
||||
nowHeader->addChild(std::move(nowLabel));
|
||||
|
||||
@@ -222,14 +222,14 @@ std::unique_ptr<Flex> MediaTab::create() {
|
||||
title->setText(i18n::tr("control-center.media.nothing-playing"));
|
||||
title->setBold(true);
|
||||
title->setFontSize((Style::fontSizeTitle + Style::spaceXs) * scale);
|
||||
title->setColor(roleColor(ColorRole::OnSurface));
|
||||
title->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
m_trackTitle = title.get();
|
||||
metadataStack->addChild(std::move(title));
|
||||
|
||||
auto artist = std::make_unique<Label>();
|
||||
artist->setText(i18n::tr("control-center.media.start-playback"));
|
||||
artist->setFontSize(Style::fontSizeBody * scale);
|
||||
artist->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
artist->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_trackArtist = artist.get();
|
||||
metadataStack->addChild(std::move(artist));
|
||||
|
||||
@@ -237,7 +237,7 @@ std::unique_ptr<Flex> MediaTab::create() {
|
||||
album->setText("");
|
||||
album->setCaptionStyle();
|
||||
album->setFontSize(Style::fontSizeCaption * scale);
|
||||
album->setColor(roleColor(ColorRole::Secondary));
|
||||
album->setColor(colorSpecFromRole(ColorRole::Secondary));
|
||||
album->setVisible(false);
|
||||
m_trackAlbum = album.get();
|
||||
metadataStack->addChild(std::move(album));
|
||||
@@ -394,7 +394,7 @@ std::unique_ptr<Flex> MediaTab::create() {
|
||||
visualizerLabel->setText(i18n::tr("control-center.media.spectrum"));
|
||||
visualizerLabel->setBold(true);
|
||||
visualizerLabel->setFontSize(Style::fontSizeTitle * scale);
|
||||
visualizerLabel->setColor(roleColor(ColorRole::OnSurface));
|
||||
visualizerLabel->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
visualizerColumn->addChild(std::move(visualizerLabel));
|
||||
|
||||
auto visualizerBody = std::make_unique<Flex>();
|
||||
@@ -406,7 +406,7 @@ std::unique_ptr<Flex> MediaTab::create() {
|
||||
m_visualizerBody = visualizerBody.get();
|
||||
|
||||
auto visualizerSpectrum = std::make_unique<AudioSpectrum>();
|
||||
visualizerSpectrum->setGradient(resolveColorRole(ColorRole::Secondary), resolveColorRole(ColorRole::Tertiary));
|
||||
visualizerSpectrum->setGradient(colorForRole(ColorRole::Secondary), colorForRole(ColorRole::Tertiary));
|
||||
visualizerSpectrum->setSpacingRatio(0.5f);
|
||||
visualizerSpectrum->setOrientation(AudioSpectrumOrientation::Vertical);
|
||||
visualizerSpectrum->setMirrored(true);
|
||||
|
||||
@@ -71,20 +71,20 @@ namespace {
|
||||
setPadding(Style::spaceSm, Style::spaceMd);
|
||||
setMinHeight(kRowMinHeight);
|
||||
setRadius(Style::radiusMd);
|
||||
setFill(roleColor(ColorRole::Surface));
|
||||
setFill(colorSpecFromRole(ColorRole::Surface));
|
||||
clearBorder();
|
||||
|
||||
auto signalGlyph = std::make_unique<Glyph>();
|
||||
signalGlyph->setGlyph(NetworkService::wifiGlyphForSignal(m_ap.strength));
|
||||
signalGlyph->setGlyphSize(Style::fontSizeBody);
|
||||
signalGlyph->setColor(roleColor(ColorRole::OnSurface));
|
||||
signalGlyph->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
addChild(std::move(signalGlyph));
|
||||
|
||||
auto ssid = std::make_unique<Label>();
|
||||
ssid->setText(m_ap.ssid);
|
||||
ssid->setBold(m_ap.active);
|
||||
ssid->setFontSize(Style::fontSizeBody);
|
||||
ssid->setColor(roleColor(ColorRole::OnSurface));
|
||||
ssid->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
ssid->setFlexGrow(1.0f);
|
||||
m_title = ssid.get();
|
||||
addChild(std::move(ssid));
|
||||
@@ -93,7 +93,7 @@ namespace {
|
||||
auto lock = std::make_unique<Glyph>();
|
||||
lock->setGlyph("lock");
|
||||
lock->setGlyphSize(Style::fontSizeCaption);
|
||||
lock->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
lock->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
addChild(std::move(lock));
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace {
|
||||
strength->setText(std::to_string(static_cast<int>(m_ap.strength)) + "%");
|
||||
strength->setCaptionStyle();
|
||||
strength->setFontSize(Style::fontSizeCaption);
|
||||
strength->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
strength->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
addChild(std::move(strength));
|
||||
|
||||
if (saved) {
|
||||
@@ -160,21 +160,21 @@ namespace {
|
||||
const bool hov = m_inputArea != nullptr && m_inputArea->hovered();
|
||||
const bool pressed = m_inputArea != nullptr && m_inputArea->pressed();
|
||||
if (pressed) {
|
||||
setFill(roleColor(ColorRole::Primary));
|
||||
setBorder(roleColor(ColorRole::Primary), Style::borderWidth);
|
||||
setFill(colorSpecFromRole(ColorRole::Primary));
|
||||
setBorder(colorSpecFromRole(ColorRole::Primary), Style::borderWidth);
|
||||
if (m_title != nullptr) {
|
||||
m_title->setColor(roleColor(ColorRole::OnPrimary));
|
||||
m_title->setColor(colorSpecFromRole(ColorRole::OnPrimary));
|
||||
}
|
||||
return;
|
||||
}
|
||||
setFill(roleColor(m_ap.active ? ColorRole::SurfaceVariant : ColorRole::Surface));
|
||||
setFill(colorSpecFromRole(m_ap.active ? ColorRole::SurfaceVariant : ColorRole::Surface));
|
||||
if (hov) {
|
||||
setBorder(roleColor(ColorRole::Primary), Style::borderWidth);
|
||||
setBorder(colorSpecFromRole(ColorRole::Primary), Style::borderWidth);
|
||||
} else {
|
||||
clearBorder();
|
||||
}
|
||||
if (m_title != nullptr) {
|
||||
m_title->setColor(roleColor(ColorRole::OnSurface));
|
||||
m_title->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,14 +222,14 @@ std::unique_ptr<Flex> NetworkTab::create() {
|
||||
auto title = std::make_unique<Label>();
|
||||
title->setBold(true);
|
||||
title->setFontSize(Style::fontSizeTitle * scale);
|
||||
title->setColor(roleColor(ColorRole::OnSurface));
|
||||
title->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
m_currentTitle = title.get();
|
||||
currentCard->addChild(std::move(title));
|
||||
|
||||
auto detail = std::make_unique<Label>();
|
||||
detail->setCaptionStyle();
|
||||
detail->setFontSize(Style::fontSizeCaption * scale);
|
||||
detail->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
detail->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_currentDetail = detail.get();
|
||||
currentCard->addChild(std::move(detail));
|
||||
|
||||
@@ -262,7 +262,7 @@ std::unique_ptr<Flex> NetworkTab::create() {
|
||||
auto passwordTitle = std::make_unique<Label>();
|
||||
passwordTitle->setBold(true);
|
||||
passwordTitle->setFontSize(Style::fontSizeBody * scale);
|
||||
passwordTitle->setColor(roleColor(ColorRole::OnSurface));
|
||||
passwordTitle->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
m_passwordTitle = passwordTitle.get();
|
||||
passwordCard->addChild(std::move(passwordTitle));
|
||||
|
||||
@@ -346,7 +346,7 @@ std::unique_ptr<Flex> NetworkTab::createHeaderActions() {
|
||||
auto wifiLabel = std::make_unique<Label>();
|
||||
wifiLabel->setText(i18n::tr("control-center.network.wifi"));
|
||||
wifiLabel->setFontSize(Style::fontSizeCaption * scale);
|
||||
wifiLabel->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
wifiLabel->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
row->addChild(std::move(wifiLabel));
|
||||
|
||||
auto wifiToggle = std::make_unique<Toggle>();
|
||||
@@ -362,7 +362,7 @@ std::unique_ptr<Flex> NetworkTab::createHeaderActions() {
|
||||
|
||||
auto spinner = std::make_unique<Spinner>();
|
||||
spinner->setSpinnerSize(Style::fontSizeBody * scale);
|
||||
spinner->setColor(roleColor(ColorRole::Primary));
|
||||
spinner->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
m_scanSpinner = spinner.get();
|
||||
row->addChild(std::move(spinner));
|
||||
|
||||
@@ -526,7 +526,7 @@ void NetworkTab::rebuildApList(Renderer& renderer) {
|
||||
: i18n::tr("control-center.network.unavailable-title"));
|
||||
empty->setCaptionStyle();
|
||||
empty->setFontSize(Style::fontSizeCaption);
|
||||
empty->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
empty->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_list->addChild(std::move(empty));
|
||||
} else {
|
||||
for (const auto& ap : aps) {
|
||||
|
||||
@@ -241,14 +241,14 @@ void NotificationsTab::rebuild(Renderer& renderer, float width) {
|
||||
title->setText(i18n::tr("control-center.notifications.empty-title"));
|
||||
title->setBold(true);
|
||||
title->setFontSize(Style::fontSizeBody * scale);
|
||||
title->setColor(roleColor(ColorRole::OnSurface));
|
||||
title->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
empty->addChild(std::move(title));
|
||||
|
||||
auto body = std::make_unique<Label>();
|
||||
body->setText(i18n::tr("control-center.notifications.empty-body"));
|
||||
body->setCaptionStyle();
|
||||
body->setFontSize(Style::fontSizeCaption * scale);
|
||||
body->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
body->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
empty->addChild(std::move(body));
|
||||
|
||||
m_list->addChild(std::move(empty));
|
||||
@@ -288,7 +288,7 @@ void NotificationsTab::rebuild(Renderer& renderer, float width) {
|
||||
meta->setText(it->notification.appName + " • " + statusText(*it));
|
||||
meta->setCaptionStyle();
|
||||
meta->setFontSize(Style::fontSizeCaption * scale);
|
||||
meta->setColor(roleColor(statusColorRole(*it)));
|
||||
meta->setColor(colorSpecFromRole(statusColorRole(*it)));
|
||||
meta->setMaxWidth(metaTextWidth);
|
||||
meta->setFlexGrow(1.0f);
|
||||
meta->measure(renderer);
|
||||
@@ -339,7 +339,7 @@ void NotificationsTab::rebuild(Renderer& renderer, float width) {
|
||||
auto body = std::make_unique<Label>();
|
||||
body->setText(bodyText);
|
||||
body->setFontSize(Style::fontSizeCaption * scale);
|
||||
body->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
body->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
body->setMaxWidth(cardTextWidth);
|
||||
body->setMaxLines(expanded ? kExpandedMaxLines : kBodyMaxLines);
|
||||
body->measure(renderer);
|
||||
|
||||
@@ -96,7 +96,7 @@ std::unique_ptr<Flex> OverviewTab::create() {
|
||||
const float avatarSize = overviewAvatarSize(scale);
|
||||
auto avatar = std::make_unique<Image>();
|
||||
avatar->setRadius(avatarSize * 0.5f);
|
||||
avatar->setBorder(roleColor(ColorRole::Primary), Style::borderWidth * 3.0f);
|
||||
avatar->setBorder(colorSpecFromRole(ColorRole::Primary), Style::borderWidth * 3.0f);
|
||||
avatar->setFit(ImageFit::Cover);
|
||||
avatar->setPadding(1.0f * scale);
|
||||
avatar->setSize(avatarSize, avatarSize);
|
||||
@@ -117,14 +117,14 @@ std::unique_ptr<Flex> OverviewTab::create() {
|
||||
userTitle->setText(displayName);
|
||||
userTitle->setBold(true);
|
||||
userTitle->setFontSize(Style::fontSizeTitle * 1.12f * scale);
|
||||
userTitle->setColor(roleColor(ColorRole::OnSurface));
|
||||
userTitle->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
userTitle->setShadow(Color{0.0f, 0.0f, 0.0f, 0.42f}, 0.0f, 1.0f * scale);
|
||||
userMain->addChild(std::move(userTitle));
|
||||
|
||||
auto userFacts = std::make_unique<Label>();
|
||||
userFacts->setText("…");
|
||||
userFacts->setFontSize(Style::fontSizeCaption * scale);
|
||||
userFacts->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
userFacts->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
userFacts->setShadow(Color{0.0f, 0.0f, 0.0f, 0.36f}, 0.0f, 1.0f * scale);
|
||||
m_userFacts = userFacts.get();
|
||||
userMain->addChild(std::move(userFacts));
|
||||
@@ -158,14 +158,14 @@ std::unique_ptr<Flex> OverviewTab::create() {
|
||||
timeLabel->setText(formatLocalTime("{:%H:%M}"));
|
||||
timeLabel->setBold(true);
|
||||
timeLabel->setFontSize(Style::fontSizeTitle * 1.8f * scale);
|
||||
timeLabel->setColor(roleColor(ColorRole::Primary));
|
||||
timeLabel->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
m_timeLabel = timeLabel.get();
|
||||
dateTimeContent->addChild(std::move(timeLabel));
|
||||
|
||||
auto dateLabel = std::make_unique<Label>();
|
||||
dateLabel->setText(formatCurrentDate());
|
||||
dateLabel->setFontSize(Style::fontSizeBody * scale);
|
||||
dateLabel->setColor(roleColor(ColorRole::OnSurface));
|
||||
dateLabel->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
m_dateLabel = dateLabel.get();
|
||||
dateTimeContent->addChild(std::move(dateLabel));
|
||||
|
||||
@@ -177,13 +177,13 @@ std::unique_ptr<Flex> OverviewTab::create() {
|
||||
auto wGlyph = std::make_unique<Glyph>();
|
||||
wGlyph->setGlyph("weather-cloud-sun");
|
||||
wGlyph->setGlyphSize(Style::fontSizeBody * scale);
|
||||
wGlyph->setColor(roleColor(ColorRole::Primary));
|
||||
wGlyph->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
m_weatherGlyph = wGlyph.get();
|
||||
|
||||
auto wLine = std::make_unique<Label>();
|
||||
wLine->setText("—");
|
||||
wLine->setFontSize(Style::fontSizeCaption * scale);
|
||||
wLine->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
wLine->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_weatherLine = wLine.get();
|
||||
|
||||
weatherRow->addChild(std::move(wGlyph));
|
||||
@@ -221,25 +221,25 @@ std::unique_ptr<Flex> OverviewTab::create() {
|
||||
auto mediaTrack = std::make_unique<Label>();
|
||||
mediaTrack->setText("...");
|
||||
mediaTrack->setFontSize(Style::fontSizeBody * scale);
|
||||
mediaTrack->setColor(roleColor(ColorRole::OnSurface));
|
||||
mediaTrack->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
m_mediaTrack = mediaTrack.get();
|
||||
|
||||
auto mediaArtist = std::make_unique<Label>();
|
||||
mediaArtist->setText(i18n::tr("control-center.overview.media.no-active-player"));
|
||||
mediaArtist->setFontSize(Style::fontSizeCaption * scale);
|
||||
mediaArtist->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
mediaArtist->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_mediaArtist = mediaArtist.get();
|
||||
|
||||
auto mediaStatus = std::make_unique<Label>();
|
||||
mediaStatus->setText(i18n::tr("control-center.overview.media.idle"));
|
||||
mediaStatus->setFontSize(Style::fontSizeCaption * scale);
|
||||
mediaStatus->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
mediaStatus->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_mediaStatus = mediaStatus.get();
|
||||
|
||||
auto mediaProgress = std::make_unique<Label>();
|
||||
mediaProgress->setText(" ");
|
||||
mediaProgress->setFontSize(Style::fontSizeCaption * scale);
|
||||
mediaProgress->setColor(roleColor(ColorRole::Secondary));
|
||||
mediaProgress->setColor(colorSpecFromRole(ColorRole::Secondary));
|
||||
mediaProgress->setVisible(false);
|
||||
m_mediaProgress = mediaProgress.get();
|
||||
|
||||
@@ -403,7 +403,7 @@ void OverviewTab::doLayout(Renderer& renderer, float contentWidth, float bodyHei
|
||||
const float radius = std::max(0.0f, Style::radiusXl * contentScale() - bw);
|
||||
m_wallpaperGradient->setPosition(bw, bw);
|
||||
m_wallpaperGradient->setFrameSize(cw, ch);
|
||||
const Color surface = resolveThemeColor(roleColor(ColorRole::Surface));
|
||||
const Color surface = colorForRole(ColorRole::Surface);
|
||||
m_wallpaperGradient->setStyle(RoundedRectStyle{
|
||||
.fill = surface,
|
||||
.fillEnd = rgba(surface.r, surface.g, surface.b, 0.0f),
|
||||
@@ -518,22 +518,22 @@ void OverviewTab::sync(Renderer& renderer) {
|
||||
if (m_weatherGlyph != nullptr && m_weatherLine != nullptr) {
|
||||
if (m_weather == nullptr || !m_weather->enabled()) {
|
||||
m_weatherGlyph->setGlyph("weather-cloud-off");
|
||||
m_weatherGlyph->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_weatherGlyph->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_weatherLine->setText(i18n::tr("control-center.overview.weather.disabled"));
|
||||
} else if (!m_weather->locationConfigured()) {
|
||||
m_weatherGlyph->setGlyph("weather-cloud");
|
||||
m_weatherGlyph->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_weatherGlyph->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_weatherLine->setText(i18n::tr("control-center.overview.weather.configure-location"));
|
||||
} else {
|
||||
const auto& snapshot = m_weather->snapshot();
|
||||
if (!snapshot.valid) {
|
||||
m_weatherGlyph->setGlyph("weather-cloud");
|
||||
m_weatherGlyph->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_weatherGlyph->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_weatherLine->setText(m_weather->loading() ? i18n::tr("control-center.overview.weather.fetching")
|
||||
: i18n::tr("control-center.overview.weather.data-unavailable"));
|
||||
} else {
|
||||
m_weatherGlyph->setGlyph(WeatherService::glyphForCode(snapshot.current.weatherCode, snapshot.current.isDay));
|
||||
m_weatherGlyph->setColor(roleColor(ColorRole::Primary));
|
||||
m_weatherGlyph->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
const int t = static_cast<int>(std::lround(m_weather->displayTemperature(snapshot.current.temperatureC)));
|
||||
m_weatherLine->setText(std::format("{}{} · {}", t, m_weather->displayTemperatureUnit(),
|
||||
WeatherService::descriptionForCode(snapshot.current.weatherCode)));
|
||||
@@ -548,7 +548,7 @@ void OverviewTab::sync(Renderer& renderer) {
|
||||
m_mediaStatus->setText(i18n::tr("control-center.overview.media.unavailable"));
|
||||
m_mediaProgress->setText(" ");
|
||||
m_mediaProgress->setVisible(false);
|
||||
m_mediaStatus->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_mediaStatus->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
if (m_mediaArt != nullptr) {
|
||||
m_mediaArt->clear(renderer);
|
||||
}
|
||||
@@ -561,7 +561,7 @@ void OverviewTab::sync(Renderer& renderer) {
|
||||
m_mediaStatus->setText(i18n::tr("control-center.overview.media.idle"));
|
||||
m_mediaProgress->setText(" ");
|
||||
m_mediaProgress->setVisible(false);
|
||||
m_mediaStatus->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_mediaStatus->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
if (m_mediaArt != nullptr) {
|
||||
m_mediaArt->clear(renderer);
|
||||
}
|
||||
@@ -604,13 +604,13 @@ void OverviewTab::sync(Renderer& renderer) {
|
||||
}
|
||||
if (active->playbackStatus == "Playing") {
|
||||
m_mediaStatus->setText(i18n::tr("control-center.overview.media.playing"));
|
||||
m_mediaStatus->setColor(roleColor(ColorRole::Primary));
|
||||
m_mediaStatus->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
} else if (active->playbackStatus == "Paused") {
|
||||
m_mediaStatus->setText(i18n::tr("control-center.overview.media.paused"));
|
||||
m_mediaStatus->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_mediaStatus->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
} else {
|
||||
m_mediaStatus->setText(active->playbackStatus);
|
||||
m_mediaStatus->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_mediaStatus->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace {
|
||||
label->setText(title);
|
||||
label->setBold(true);
|
||||
label->setFontSize(Style::fontSizeTitle * scale);
|
||||
label->setColor(roleColor(ColorRole::OnSurface));
|
||||
label->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
label->setFlexGrow(1.0f);
|
||||
row->addChild(std::move(label));
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace {
|
||||
Label* makeValueLabel(Flex& parent, float scale) {
|
||||
auto label = std::make_unique<Label>();
|
||||
label->setFontSize(Style::fontSizeBody * scale);
|
||||
label->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
label->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
auto* ptr = label.get();
|
||||
parent.addChild(std::move(label));
|
||||
return ptr;
|
||||
@@ -63,7 +63,7 @@ namespace {
|
||||
auto icon = std::make_unique<Glyph>();
|
||||
icon->setGlyph(glyphName);
|
||||
icon->setGlyphSize(Style::fontSizeBody * scale);
|
||||
icon->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
icon->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
if (outIcon != nullptr) {
|
||||
*outIcon = icon.get();
|
||||
}
|
||||
@@ -217,7 +217,7 @@ std::unique_ptr<Flex> SystemTab::create() {
|
||||
|
||||
auto infoLabel = std::make_unique<Label>();
|
||||
infoLabel->setFontSize(Style::fontSizeCaption * sc);
|
||||
infoLabel->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
infoLabel->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
|
||||
infoLabel->setText(
|
||||
buildSystemInfoText(m_monitor != nullptr && m_monitor->isRunning() ? m_monitor->latest() : SystemStats{}));
|
||||
@@ -340,47 +340,47 @@ void SystemTab::doUpdate(Renderer& renderer) {
|
||||
}
|
||||
|
||||
if (m_cpuGraph != nullptr) {
|
||||
m_cpuGraph->setLineColor1(resolveThemeColor(roleColor(ColorRole::Primary)));
|
||||
m_cpuGraph->setLineColor2(resolveThemeColor(roleColor(ColorRole::Error)));
|
||||
m_cpuGraph->setLineColor1(colorForRole(ColorRole::Primary));
|
||||
m_cpuGraph->setLineColor2(colorForRole(ColorRole::Error));
|
||||
}
|
||||
if (m_cpuPctIcon != nullptr) {
|
||||
m_cpuPctIcon->setColor(roleColor(ColorRole::Primary));
|
||||
m_cpuPctIcon->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
}
|
||||
if (m_cpuPctLabel != nullptr) {
|
||||
m_cpuPctLabel->setColor(roleColor(ColorRole::Primary));
|
||||
m_cpuPctLabel->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
}
|
||||
if (m_cpuTempIcon != nullptr) {
|
||||
m_cpuTempIcon->setColor(roleColor(ColorRole::Error));
|
||||
m_cpuTempIcon->setColor(colorSpecFromRole(ColorRole::Error));
|
||||
}
|
||||
if (m_cpuTempLabel != nullptr) {
|
||||
m_cpuTempLabel->setColor(roleColor(ColorRole::Error));
|
||||
m_cpuTempLabel->setColor(colorSpecFromRole(ColorRole::Error));
|
||||
}
|
||||
|
||||
if (m_ramGraph != nullptr) {
|
||||
m_ramGraph->setLineColor1(resolveThemeColor(roleColor(ColorRole::Secondary)));
|
||||
m_ramGraph->setLineColor1(colorForRole(ColorRole::Secondary));
|
||||
}
|
||||
if (m_ramIcon != nullptr) {
|
||||
m_ramIcon->setColor(roleColor(ColorRole::Secondary));
|
||||
m_ramIcon->setColor(colorSpecFromRole(ColorRole::Secondary));
|
||||
}
|
||||
if (m_ramLabel != nullptr) {
|
||||
m_ramLabel->setColor(roleColor(ColorRole::Secondary));
|
||||
m_ramLabel->setColor(colorSpecFromRole(ColorRole::Secondary));
|
||||
}
|
||||
|
||||
if (m_netGraph != nullptr) {
|
||||
m_netGraph->setLineColor1(resolveThemeColor(roleColor(ColorRole::Tertiary)));
|
||||
m_netGraph->setLineColor2(resolveThemeColor(roleColor(ColorRole::Secondary)));
|
||||
m_netGraph->setLineColor1(colorForRole(ColorRole::Tertiary));
|
||||
m_netGraph->setLineColor2(colorForRole(ColorRole::Secondary));
|
||||
}
|
||||
if (m_rxIcon != nullptr) {
|
||||
m_rxIcon->setColor(roleColor(ColorRole::Tertiary));
|
||||
m_rxIcon->setColor(colorSpecFromRole(ColorRole::Tertiary));
|
||||
}
|
||||
if (m_rxLabel != nullptr) {
|
||||
m_rxLabel->setColor(roleColor(ColorRole::Tertiary));
|
||||
m_rxLabel->setColor(colorSpecFromRole(ColorRole::Tertiary));
|
||||
}
|
||||
if (m_txIcon != nullptr) {
|
||||
m_txIcon->setColor(roleColor(ColorRole::Secondary));
|
||||
m_txIcon->setColor(colorSpecFromRole(ColorRole::Secondary));
|
||||
}
|
||||
if (m_txLabel != nullptr) {
|
||||
m_txLabel->setColor(roleColor(ColorRole::Secondary));
|
||||
m_txLabel->setColor(colorSpecFromRole(ColorRole::Secondary));
|
||||
}
|
||||
|
||||
const bool monitorRunning = m_monitor->isRunning();
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace control_center {
|
||||
label->setText(text);
|
||||
label->setBold(true);
|
||||
label->setFontSize(Style::fontSizeTitle * scale);
|
||||
label->setColor(roleColor(ColorRole::OnSurface));
|
||||
label->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
auto* ptr = label.get();
|
||||
parent.addChild(std::move(label));
|
||||
return ptr;
|
||||
@@ -30,7 +30,7 @@ namespace control_center {
|
||||
auto label = std::make_unique<Label>();
|
||||
label->setText(text);
|
||||
label->setFontSize(Style::fontSizeBody * scale);
|
||||
label->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
label->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
parent.addChild(std::move(label));
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ std::unique_ptr<Flex> WeatherTab::create() {
|
||||
auto currentGlyph = std::make_unique<Glyph>();
|
||||
currentGlyph->setGlyph("weather-cloud");
|
||||
currentGlyph->setGlyphSize(kCurrentGlyphSize * scale);
|
||||
currentGlyph->setColor(roleColor(ColorRole::Primary));
|
||||
currentGlyph->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
m_currentGlyph = currentGlyph.get();
|
||||
currentCard->addChild(std::move(currentGlyph));
|
||||
|
||||
@@ -109,14 +109,14 @@ std::unique_ptr<Flex> WeatherTab::create() {
|
||||
temp->setText("--°C");
|
||||
temp->setBold(true);
|
||||
temp->setFontSize(Style::fontSizeTitle * 2.35f * scale);
|
||||
temp->setColor(roleColor(ColorRole::OnSurface));
|
||||
temp->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
m_currentTempLabel = temp.get();
|
||||
currentTop->addChild(std::move(temp));
|
||||
|
||||
auto hilo = std::make_unique<Label>();
|
||||
hilo->setText("--↑ --↓");
|
||||
hilo->setFontSize(Style::fontSizeBody * scale);
|
||||
hilo->setColor(roleColor(ColorRole::Primary));
|
||||
hilo->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
m_currentHiLoLabel = hilo.get();
|
||||
currentTop->addChild(std::move(hilo));
|
||||
|
||||
@@ -128,7 +128,7 @@ std::unique_ptr<Flex> WeatherTab::create() {
|
||||
auto currentDesc = std::make_unique<Label>();
|
||||
currentDesc->setText(i18n::tr("control-center.weather.waiting"));
|
||||
currentDesc->setFontSize(Style::fontSizeBody * scale);
|
||||
currentDesc->setColor(roleColor(ColorRole::OnSurface));
|
||||
currentDesc->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
m_currentDescLabel = currentDesc.get();
|
||||
currentBottom->addChild(std::move(currentDesc));
|
||||
|
||||
@@ -136,7 +136,7 @@ std::unique_ptr<Flex> WeatherTab::create() {
|
||||
updated->setText(" ");
|
||||
updated->setCaptionStyle();
|
||||
updated->setFontSize(Style::fontSizeCaption * scale);
|
||||
updated->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
updated->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_updatedLabel = updated.get();
|
||||
currentBottom->addChild(std::move(updated));
|
||||
|
||||
@@ -144,7 +144,7 @@ std::unique_ptr<Flex> WeatherTab::create() {
|
||||
status->setText(" ");
|
||||
status->setCaptionStyle();
|
||||
status->setFontSize(Style::fontSizeCaption * scale);
|
||||
status->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
status->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
status->setVisible(false);
|
||||
m_statusLabel = status.get();
|
||||
currentBottom->addChild(std::move(status));
|
||||
@@ -180,12 +180,12 @@ std::unique_ptr<Flex> WeatherTab::create() {
|
||||
auto icon = std::make_unique<Glyph>();
|
||||
icon->setGlyph(iconName);
|
||||
icon->setGlyphSize((Style::fontSizeBody + Style::spaceXs) * scale);
|
||||
icon->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
icon->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
row->addChild(std::move(icon));
|
||||
|
||||
auto keyLabel = std::make_unique<Label>();
|
||||
keyLabel->setText(key);
|
||||
keyLabel->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
keyLabel->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
keyLabel->setFontSize(Style::fontSizeBody * scale);
|
||||
keyLabel->setMinWidth(detailKeyWidth - (Style::fontSizeBody + Style::spaceXs) * scale - Style::spaceSm * scale);
|
||||
row->addChild(std::move(keyLabel));
|
||||
@@ -194,7 +194,7 @@ std::unique_ptr<Flex> WeatherTab::create() {
|
||||
value->setText("--");
|
||||
value->setBold(true);
|
||||
value->setFontSize(Style::fontSizeBody * scale);
|
||||
value->setColor(roleColor(ColorRole::OnSurface));
|
||||
value->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
value->setTextAlign(TextAlign::End);
|
||||
value->setFlexGrow(1.0f);
|
||||
valueOut = value.get();
|
||||
@@ -248,7 +248,7 @@ std::unique_ptr<Flex> WeatherTab::create() {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph("weather-cloud");
|
||||
glyph->setGlyphSize(Style::fontSizeBody * 1.2f * scale);
|
||||
glyph->setColor(roleColor(ColorRole::OnSurface));
|
||||
glyph->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
m_dayGlyphs[i] = glyph.get();
|
||||
daySlot->addChild(std::move(glyph));
|
||||
|
||||
@@ -256,7 +256,7 @@ std::unique_ptr<Flex> WeatherTab::create() {
|
||||
meta->setText(i18n::tr("control-center.weather.forecast-placeholder.day"));
|
||||
meta->setBold(true);
|
||||
meta->setFontSize(Style::fontSizeBody * scale);
|
||||
meta->setColor(roleColor(ColorRole::OnSurface));
|
||||
meta->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
meta->setStableBaseline(true);
|
||||
m_dayMetas[i] = meta.get();
|
||||
daySlot->addChild(std::move(meta));
|
||||
@@ -266,7 +266,7 @@ std::unique_ptr<Flex> WeatherTab::create() {
|
||||
temps->setText(i18n::tr("control-center.weather.forecast-placeholder.temperature"));
|
||||
temps->setBold(true);
|
||||
temps->setFontSize(Style::fontSizeBody * scale);
|
||||
temps->setColor(roleColor(ColorRole::OnSurface));
|
||||
temps->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
temps->setTextAlign(TextAlign::End);
|
||||
temps->setStableBaseline(true);
|
||||
m_dayTemps[i] = temps.get();
|
||||
@@ -275,7 +275,7 @@ std::unique_ptr<Flex> WeatherTab::create() {
|
||||
auto desc = std::make_unique<Label>();
|
||||
desc->setText(i18n::tr("control-center.weather.forecast-placeholder.description"));
|
||||
desc->setFontSize(Style::fontSizeCaption * scale);
|
||||
desc->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
desc->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_dayDescs[i] = desc.get();
|
||||
|
||||
row->addChild(std::move(topRow));
|
||||
@@ -516,7 +516,7 @@ void WeatherTab::sync(Renderer& renderer) {
|
||||
}
|
||||
|
||||
if (m_weather == nullptr || !m_weather->enabled()) {
|
||||
m_currentGlyph->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_currentGlyph->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_currentTempLabel->setText("--°C");
|
||||
if (m_currentHiLoLabel != nullptr) {
|
||||
m_currentHiLoLabel->setText("-- / --");
|
||||
@@ -550,7 +550,7 @@ void WeatherTab::sync(Renderer& renderer) {
|
||||
}
|
||||
|
||||
if (!m_weather->locationConfigured()) {
|
||||
m_currentGlyph->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_currentGlyph->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_currentTempLabel->setText(std::format("--{}", m_weather->displayTemperatureUnit()));
|
||||
if (m_currentHiLoLabel != nullptr) {
|
||||
m_currentHiLoLabel->setText("-- / --");
|
||||
@@ -585,7 +585,7 @@ void WeatherTab::sync(Renderer& renderer) {
|
||||
|
||||
const auto& snapshot = m_weather->snapshot();
|
||||
if (!snapshot.valid) {
|
||||
m_currentGlyph->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_currentGlyph->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_currentTempLabel->setText(std::format("--{}", m_weather->displayTemperatureUnit()));
|
||||
if (m_currentHiLoLabel != nullptr) {
|
||||
m_currentHiLoLabel->setText("-- / --");
|
||||
@@ -621,7 +621,7 @@ void WeatherTab::sync(Renderer& renderer) {
|
||||
}
|
||||
|
||||
m_currentGlyph->setGlyph(WeatherService::glyphForCode(snapshot.current.weatherCode, snapshot.current.isDay));
|
||||
m_currentGlyph->setColor(roleColor(snapshot.current.isDay ? ColorRole::Primary : ColorRole::Secondary));
|
||||
m_currentGlyph->setColor(colorSpecFromRole(snapshot.current.isDay ? ColorRole::Primary : ColorRole::Secondary));
|
||||
m_currentTempLabel->setText(
|
||||
std::format("{}{}", static_cast<int>(std::lround(m_weather->displayTemperature(snapshot.current.temperatureC))),
|
||||
m_weather->displayTemperatureUnit()));
|
||||
@@ -643,7 +643,8 @@ void WeatherTab::sync(Renderer& renderer) {
|
||||
const std::string status = m_weather->loading() ? i18n::tr("control-center.weather.refreshing")
|
||||
: (snapshot.valid ? std::string{} : m_weather->error());
|
||||
m_statusLabel->setText(status);
|
||||
m_statusLabel->setColor(roleColor(m_weather->error().empty() ? ColorRole::OnSurfaceVariant : ColorRole::Error));
|
||||
m_statusLabel->setColor(
|
||||
colorSpecFromRole(m_weather->error().empty() ? ColorRole::OnSurfaceVariant : ColorRole::Error));
|
||||
m_statusLabel->setVisible(!status.empty());
|
||||
if (m_windLabel != nullptr) {
|
||||
m_windLabel->setText(std::format("{} {} {}", static_cast<int>(std::lround(snapshot.current.windSpeedKmh)),
|
||||
@@ -687,7 +688,7 @@ void WeatherTab::sync(Renderer& renderer) {
|
||||
const auto& day = snapshot.forecastDays[i + forecastStart];
|
||||
if (m_dayGlyphs[i] != nullptr) {
|
||||
m_dayGlyphs[i]->setGlyph(WeatherService::glyphForCode(day.weatherCode, true));
|
||||
m_dayGlyphs[i]->setColor(roleColor(ColorRole::OnSurface));
|
||||
m_dayGlyphs[i]->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
m_dayGlyphs[i]->measure(renderer);
|
||||
}
|
||||
if (m_dayMetas[i] != nullptr) {
|
||||
@@ -718,7 +719,7 @@ void WeatherTab::sync(Renderer& renderer) {
|
||||
m_shaderTime = 0.0f;
|
||||
}
|
||||
m_effectNode->setEffectType(m_activeEffect);
|
||||
m_effectNode->setBgColor(resolveColorRole(ColorRole::Surface));
|
||||
m_effectNode->setBgColor(colorForRole(ColorRole::Surface));
|
||||
m_effectNode->setRadius(Style::radiusXl * contentScale());
|
||||
m_effectNode->setVisible(m_activeEffect != EffectType::None);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ void DesktopWidget::setRoot(std::unique_ptr<Node> root) {
|
||||
}
|
||||
}
|
||||
|
||||
void DesktopWidget::setBackgroundStyle(const ThemeColor& color, float radius, float padding) {
|
||||
void DesktopWidget::setBackgroundStyle(const ColorSpec& color, float radius, float padding) {
|
||||
m_bgEnabled = true;
|
||||
m_bgColor = color;
|
||||
m_bgRadius = radius;
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
void setRedrawCallback(RedrawCallback callback) { m_redrawCallback = std::move(callback); }
|
||||
void setContentScale(float scale) noexcept { m_contentScale = scale; }
|
||||
[[nodiscard]] float contentScale() const noexcept { return m_contentScale; }
|
||||
void setBackgroundStyle(const ThemeColor& color, float radius, float padding);
|
||||
void setBackgroundStyle(const ColorSpec& color, float radius, float padding);
|
||||
|
||||
protected:
|
||||
void setRoot(std::unique_ptr<Node> root);
|
||||
@@ -89,7 +89,7 @@ private:
|
||||
RedrawCallback m_redrawCallback;
|
||||
|
||||
bool m_bgEnabled = false;
|
||||
ThemeColor m_bgColor;
|
||||
ColorSpec m_bgColor;
|
||||
float m_bgRadius = 0.0f;
|
||||
float m_bgPadding = 0.0f;
|
||||
};
|
||||
|
||||
@@ -70,14 +70,14 @@ namespace {
|
||||
return fallback;
|
||||
}
|
||||
|
||||
ThemeColor getThemeColorSetting(const std::unordered_map<std::string, WidgetSettingValue>& settings,
|
||||
const std::string& key, const ThemeColor& fallback) {
|
||||
ColorSpec getColorSpecSetting(const std::unordered_map<std::string, WidgetSettingValue>& settings,
|
||||
const std::string& key, const ColorSpec& fallback) {
|
||||
const auto it = settings.find(key);
|
||||
if (it == settings.end()) {
|
||||
return fallback;
|
||||
}
|
||||
if (const auto* value = std::get_if<std::string>(&it->second)) {
|
||||
return themeColorFromConfigString(*value);
|
||||
return colorSpecFromConfigString(*value);
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
@@ -87,8 +87,8 @@ namespace {
|
||||
|
||||
void applyCommonSettings(DesktopWidget& widget, const std::unordered_map<std::string, WidgetSettingValue>& settings) {
|
||||
if (getBoolSetting(settings, "background", false)) {
|
||||
const ThemeColor bgColor =
|
||||
getThemeColorSetting(settings, "background_color", roleColor(ColorRole::Surface, 0.8f));
|
||||
const ColorSpec bgColor =
|
||||
getColorSpecSetting(settings, "background_color", colorSpecFromRole(ColorRole::Surface, 0.8f));
|
||||
const float radius = getFloatSetting(settings, "background_radius", kDefaultBgRadius);
|
||||
const float padding = getFloatSetting(settings, "background_padding", kDefaultBgPadding);
|
||||
widget.setBackgroundStyle(bgColor, radius, padding);
|
||||
@@ -107,10 +107,10 @@ DesktopWidgetFactory::create(const std::string& type,
|
||||
const std::unordered_map<std::string, WidgetSettingValue>& settings,
|
||||
float contentScale) const {
|
||||
if (type == "clock") {
|
||||
auto widget =
|
||||
std::make_unique<DesktopClockWidget>(getStringSetting(settings, "format", "{:%H:%M}"),
|
||||
getThemeColorSetting(settings, "color", roleColor(ColorRole::OnSurface)),
|
||||
getBoolSetting(settings, "shadow", true));
|
||||
auto widget = std::make_unique<DesktopClockWidget>(
|
||||
getStringSetting(settings, "format", "{:%H:%M}"),
|
||||
getColorSpecSetting(settings, "color", colorSpecFromRole(ColorRole::OnSurface)),
|
||||
getBoolSetting(settings, "shadow", true));
|
||||
applyCommonSettings(*widget, settings);
|
||||
widget->setContentScale(contentScale);
|
||||
return widget;
|
||||
@@ -124,8 +124,8 @@ DesktopWidgetFactory::create(const std::string& type,
|
||||
auto widget = std::make_unique<DesktopAudioVisualizerWidget>(
|
||||
m_pipewireSpectrum, getFloatSetting(settings, "aspect_ratio", kDefaultDesktopAudioVisualizerAspectRatio),
|
||||
getIntSetting(settings, "bands", 32), getBoolSetting(settings, "mirrored", true),
|
||||
getThemeColorSetting(settings, "low_color", roleColor(ColorRole::Primary)),
|
||||
getThemeColorSetting(settings, "high_color", roleColor(ColorRole::Primary)),
|
||||
getColorSpecSetting(settings, "low_color", colorSpecFromRole(ColorRole::Primary)),
|
||||
getColorSpecSetting(settings, "high_color", colorSpecFromRole(ColorRole::Primary)),
|
||||
std::clamp(getFloatSetting(settings, "min_value", 0.0f), 0.0f, 1.0f));
|
||||
applyCommonSettings(*widget, settings);
|
||||
widget->setContentScale(contentScale);
|
||||
@@ -146,7 +146,7 @@ DesktopWidgetFactory::create(const std::string& type,
|
||||
return nullptr;
|
||||
}
|
||||
auto widget = std::make_unique<DesktopWeatherWidget>(
|
||||
m_weather, getThemeColorSetting(settings, "color", roleColor(ColorRole::OnSurface)),
|
||||
m_weather, getColorSpecSetting(settings, "color", colorSpecFromRole(ColorRole::OnSurface)),
|
||||
getBoolSetting(settings, "shadow", true));
|
||||
applyCommonSettings(*widget, settings);
|
||||
widget->setContentScale(contentScale);
|
||||
@@ -160,7 +160,8 @@ DesktopWidgetFactory::create(const std::string& type,
|
||||
}
|
||||
const bool vertical = getStringSetting(settings, "layout", "horizontal") == "vertical";
|
||||
auto widget = std::make_unique<DesktopMediaPlayerWidget>(
|
||||
m_mpris, m_httpClient, vertical, getThemeColorSetting(settings, "color", roleColor(ColorRole::OnSurface)),
|
||||
m_mpris, m_httpClient, vertical,
|
||||
getColorSpecSetting(settings, "color", colorSpecFromRole(ColorRole::OnSurface)),
|
||||
getBoolSetting(settings, "shadow", true));
|
||||
applyCommonSettings(*widget, settings);
|
||||
widget->setContentScale(contentScale);
|
||||
@@ -188,8 +189,8 @@ DesktopWidgetFactory::create(const std::string& type,
|
||||
stat2 = parseStat(stat2Str);
|
||||
}
|
||||
auto widget = std::make_unique<DesktopSysmonWidget>(
|
||||
m_sysmon, stat, stat2, getThemeColorSetting(settings, "color", roleColor(ColorRole::Primary)),
|
||||
getThemeColorSetting(settings, "color2", roleColor(ColorRole::Secondary)),
|
||||
m_sysmon, stat, stat2, getColorSpecSetting(settings, "color", colorSpecFromRole(ColorRole::Primary)),
|
||||
getColorSpecSetting(settings, "color2", colorSpecFromRole(ColorRole::Secondary)),
|
||||
getBoolSetting(settings, "show_label", true), getBoolSetting(settings, "shadow", true));
|
||||
applyCommonSettings(*widget, settings);
|
||||
widget->setContentScale(contentScale);
|
||||
|
||||
@@ -378,7 +378,7 @@ void DesktopWidgetsEditor::rebuildScene(OverlaySurface& surface) {
|
||||
root->setFrameSize(static_cast<float>(surface.surface->width()), static_cast<float>(surface.surface->height()));
|
||||
|
||||
auto dim = std::make_unique<Box>();
|
||||
dim->setFill(roleColor(ColorRole::SurfaceVariant, 0.14f));
|
||||
dim->setFill(colorSpecFromRole(ColorRole::SurfaceVariant, 0.14f));
|
||||
dim->setPosition(0.0f, 0.0f);
|
||||
dim->setFrameSize(root->width(), root->height());
|
||||
dim->setZIndex(0);
|
||||
@@ -408,7 +408,7 @@ void DesktopWidgetsEditor::rebuildScene(OverlaySurface& surface) {
|
||||
for (float x = 0.0f; x <= width; x += cell) {
|
||||
auto line = std::make_unique<Box>();
|
||||
const bool major = (static_cast<int>(std::lround(x / cell)) % majorInterval) == 0;
|
||||
line->setFill(roleColor(major ? ColorRole::Primary : ColorRole::Outline, major ? 0.18f : 0.08f));
|
||||
line->setFill(colorSpecFromRole(major ? ColorRole::Primary : ColorRole::Outline, major ? 0.18f : 0.08f));
|
||||
line->setPosition(x, 0.0f);
|
||||
line->setFrameSize(1.0f, height);
|
||||
line->setZIndex(2);
|
||||
@@ -418,7 +418,7 @@ void DesktopWidgetsEditor::rebuildScene(OverlaySurface& surface) {
|
||||
for (float y = 0.0f; y <= height; y += cell) {
|
||||
auto line = std::make_unique<Box>();
|
||||
const bool major = (static_cast<int>(std::lround(y / cell)) % majorInterval) == 0;
|
||||
line->setFill(roleColor(major ? ColorRole::Primary : ColorRole::Outline, major ? 0.18f : 0.08f));
|
||||
line->setFill(colorSpecFromRole(major ? ColorRole::Primary : ColorRole::Outline, major ? 0.18f : 0.08f));
|
||||
line->setPosition(0.0f, y);
|
||||
line->setFrameSize(width, 1.0f);
|
||||
line->setZIndex(2);
|
||||
@@ -507,14 +507,14 @@ void DesktopWidgetsEditor::rebuildScene(OverlaySurface& surface) {
|
||||
|
||||
auto ringShadow = std::make_unique<Box>();
|
||||
ringShadow->setBorder(kShadowColor, 1.0f + kShadowExpand * 2.0f);
|
||||
ringShadow->setFill(clearThemeColor());
|
||||
ringShadow->setFill(clearColorSpec());
|
||||
ringShadow->setRadius(Style::radiusMd + kRotatePadding + kShadowExpand);
|
||||
surface.rotationRingShadow = ringShadow.get();
|
||||
surface.selectionFrameTransform->addChild(std::move(ringShadow));
|
||||
|
||||
auto ring = std::make_unique<Box>();
|
||||
ring->setBorder(roleColor(ColorRole::Primary), 1.0f);
|
||||
ring->setFill(clearThemeColor());
|
||||
ring->setBorder(colorSpecFromRole(ColorRole::Primary), 1.0f);
|
||||
ring->setFill(clearColorSpec());
|
||||
ring->setRadius(Style::radiusMd + kRotatePadding);
|
||||
ring->setZIndex(1);
|
||||
surface.rotationRing = ring.get();
|
||||
@@ -549,14 +549,14 @@ void DesktopWidgetsEditor::rebuildScene(OverlaySurface& surface) {
|
||||
|
||||
auto selectionBorderShadow = std::make_unique<Box>();
|
||||
selectionBorderShadow->setBorder(kShadowColor, kSelectionStroke + kShadowExpand * 2.0f);
|
||||
selectionBorderShadow->setFill(clearThemeColor());
|
||||
selectionBorderShadow->setFill(clearColorSpec());
|
||||
selectionBorderShadow->setRadius(Style::radiusMd + kShadowExpand);
|
||||
surface.selectionBorderShadow = selectionBorderShadow.get();
|
||||
selectionBorderTransform->addChild(std::move(selectionBorderShadow));
|
||||
|
||||
auto selectionBorder = std::make_unique<Box>();
|
||||
selectionBorder->setBorder(roleColor(ColorRole::Primary), kSelectionStroke);
|
||||
selectionBorder->setFill(clearThemeColor());
|
||||
selectionBorder->setBorder(colorSpecFromRole(ColorRole::Primary), kSelectionStroke);
|
||||
selectionBorder->setFill(clearColorSpec());
|
||||
selectionBorder->setRadius(Style::radiusMd);
|
||||
selectionBorder->setZIndex(1);
|
||||
surface.selectionBorder = selectionBorder.get();
|
||||
@@ -568,14 +568,14 @@ void DesktopWidgetsEditor::rebuildScene(OverlaySurface& surface) {
|
||||
|
||||
auto scaleHandleShadow = std::make_unique<Box>();
|
||||
scaleHandleShadow->setBorder(kShadowColor, kShadowExpand);
|
||||
scaleHandleShadow->setFill(clearThemeColor());
|
||||
scaleHandleShadow->setFill(clearColorSpec());
|
||||
scaleHandleShadow->setRadius(Style::radiusSm + kShadowExpand);
|
||||
scaleHandleShadow->setZIndex(103);
|
||||
surface.scaleHandleShadows[i] = scaleHandleShadow.get();
|
||||
root->addChild(std::move(scaleHandleShadow));
|
||||
|
||||
auto scaleHandle = std::make_unique<Box>();
|
||||
scaleHandle->setFill(roleColor(ColorRole::Primary));
|
||||
scaleHandle->setFill(colorSpecFromRole(ColorRole::Primary));
|
||||
scaleHandle->setRadius(Style::radiusSm);
|
||||
scaleHandle->setZIndex(104);
|
||||
surface.scaleHandles[i] = scaleHandle.get();
|
||||
@@ -610,8 +610,8 @@ void DesktopWidgetsEditor::rebuildScene(OverlaySurface& surface) {
|
||||
toolbar->setAlign(FlexAlign::Center);
|
||||
toolbar->setGap(Style::spaceSm);
|
||||
toolbar->setPadding(Style::spaceSm, Style::spaceMd);
|
||||
toolbar->setFill(roleColor(ColorRole::Surface, 0.94f));
|
||||
toolbar->setBorder(roleColor(ColorRole::Outline), Style::borderWidth);
|
||||
toolbar->setFill(colorSpecFromRole(ColorRole::Surface, 0.94f));
|
||||
toolbar->setBorder(colorSpecFromRole(ColorRole::Outline), Style::borderWidth);
|
||||
toolbar->setRadius(Style::radiusXl);
|
||||
toolbar->setZIndex(200);
|
||||
|
||||
@@ -620,7 +620,7 @@ void DesktopWidgetsEditor::rebuildScene(OverlaySurface& surface) {
|
||||
toolbarHandle->setAlign(FlexAlign::Center);
|
||||
toolbarHandle->setGap(Style::spaceXs);
|
||||
toolbarHandle->setPadding(Style::spaceXs, Style::spaceSm);
|
||||
toolbarHandle->setFill(roleColor(ColorRole::SurfaceVariant, 0.85f));
|
||||
toolbarHandle->setFill(colorSpecFromRole(ColorRole::SurfaceVariant, 0.85f));
|
||||
toolbarHandle->setRadius(Style::radiusLg);
|
||||
toolbarHandle->setMinHeight(Style::controlHeightSm);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace {
|
||||
} // namespace
|
||||
|
||||
DesktopAudioVisualizerWidget::DesktopAudioVisualizerWidget(PipeWireSpectrum* spectrum, float aspectRatio, int bands,
|
||||
bool mirrored, ThemeColor lowColor, ThemeColor highColor,
|
||||
bool mirrored, ColorSpec lowColor, ColorSpec highColor,
|
||||
float minValue)
|
||||
: m_spectrum(spectrum), m_aspectRatio(clampAspectRatio(aspectRatio)), m_bands(std::max(1, bands)),
|
||||
m_mirrored(mirrored), m_lowColor(lowColor), m_highColor(highColor), m_minValue(std::clamp(minValue, 0.0f, 1.0f)) {
|
||||
|
||||
@@ -12,7 +12,7 @@ class Renderer;
|
||||
class DesktopAudioVisualizerWidget : public DesktopWidget {
|
||||
public:
|
||||
DesktopAudioVisualizerWidget(PipeWireSpectrum* spectrum, float aspectRatio, int bands, bool mirrored,
|
||||
ThemeColor lowColor, ThemeColor highColor, float minValue);
|
||||
ColorSpec lowColor, ColorSpec highColor, float minValue);
|
||||
~DesktopAudioVisualizerWidget() override;
|
||||
|
||||
void create() override;
|
||||
@@ -28,8 +28,8 @@ private:
|
||||
float m_aspectRatio = 2.5f;
|
||||
int m_bands = 32;
|
||||
bool m_mirrored = true;
|
||||
ThemeColor m_lowColor = roleColor(ColorRole::Primary);
|
||||
ThemeColor m_highColor = roleColor(ColorRole::Primary);
|
||||
ColorSpec m_lowColor = colorSpecFromRole(ColorRole::Primary);
|
||||
ColorSpec m_highColor = colorSpecFromRole(ColorRole::Primary);
|
||||
float m_minValue = 0.0f;
|
||||
std::uint64_t m_listenerId = 0;
|
||||
AudioSpectrum* m_visualizer = nullptr;
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace {
|
||||
|
||||
} // namespace
|
||||
|
||||
DesktopClockWidget::DesktopClockWidget(std::string format, ThemeColor color, bool shadow)
|
||||
DesktopClockWidget::DesktopClockWidget(std::string format, ColorSpec color, bool shadow)
|
||||
: m_format(std::move(format)), m_color(std::move(color)), m_shadow(shadow),
|
||||
m_showsSeconds(formatShowsSeconds(m_format)) {}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class Label;
|
||||
|
||||
class DesktopClockWidget : public DesktopWidget {
|
||||
public:
|
||||
DesktopClockWidget(std::string format, ThemeColor color, bool shadow);
|
||||
DesktopClockWidget(std::string format, ColorSpec color, bool shadow);
|
||||
|
||||
void create() override;
|
||||
[[nodiscard]] bool wantsSecondTicks() const override;
|
||||
@@ -21,7 +21,7 @@ private:
|
||||
void applyShadow();
|
||||
|
||||
std::string m_format;
|
||||
ThemeColor m_color;
|
||||
ColorSpec m_color;
|
||||
bool m_shadow;
|
||||
bool m_showsSeconds = false;
|
||||
Label* m_label = nullptr;
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace {
|
||||
} // namespace
|
||||
|
||||
DesktopMediaPlayerWidget::DesktopMediaPlayerWidget(MprisService* mpris, HttpClient* httpClient, bool vertical,
|
||||
ThemeColor color, bool shadow)
|
||||
ColorSpec color, bool shadow)
|
||||
: m_mpris(mpris), m_httpClient(httpClient), m_vertical(vertical), m_color(std::move(color)), m_shadow(shadow) {}
|
||||
|
||||
void DesktopMediaPlayerWidget::create() {
|
||||
|
||||
@@ -15,7 +15,7 @@ class MprisService;
|
||||
|
||||
class DesktopMediaPlayerWidget : public DesktopWidget {
|
||||
public:
|
||||
DesktopMediaPlayerWidget(MprisService* mpris, HttpClient* httpClient, bool vertical, ThemeColor color, bool shadow);
|
||||
DesktopMediaPlayerWidget(MprisService* mpris, HttpClient* httpClient, bool vertical, ColorSpec color, bool shadow);
|
||||
|
||||
void create() override;
|
||||
[[nodiscard]] bool wantsSecondTicks() const override { return true; }
|
||||
@@ -33,7 +33,7 @@ private:
|
||||
MprisService* m_mpris;
|
||||
HttpClient* m_httpClient;
|
||||
bool m_vertical;
|
||||
ThemeColor m_color;
|
||||
ColorSpec m_color;
|
||||
bool m_shadow;
|
||||
|
||||
Image* m_artwork = nullptr;
|
||||
|
||||
@@ -24,8 +24,8 @@ namespace {
|
||||
} // namespace
|
||||
|
||||
DesktopSysmonWidget::DesktopSysmonWidget(SystemMonitorService* monitor, DesktopSysmonStat stat,
|
||||
std::optional<DesktopSysmonStat> stat2, ThemeColor lineColor,
|
||||
ThemeColor lineColor2, bool showLabel, bool shadow)
|
||||
std::optional<DesktopSysmonStat> stat2, ColorSpec lineColor,
|
||||
ColorSpec lineColor2, bool showLabel, bool shadow)
|
||||
: m_monitor(monitor), m_stat(stat), m_stat2(stat2), m_lineColor(lineColor), m_lineColor2(lineColor2),
|
||||
m_showLabel(showLabel), m_shadow(shadow) {
|
||||
if (m_monitor != nullptr) {
|
||||
@@ -105,14 +105,14 @@ void DesktopSysmonWidget::doLayout(Renderer& renderer) {
|
||||
const float fontSize = Style::fontSizeBody * scale;
|
||||
const float gap = Style::spaceSm * scale;
|
||||
|
||||
m_graphNode->setLineColor1(resolveThemeColor(m_lineColor));
|
||||
m_graphNode->setLineColor1(resolveColorSpec(m_lineColor));
|
||||
if (m_stat2.has_value()) {
|
||||
m_graphNode->setLineColor2(resolveThemeColor(m_lineColor2));
|
||||
m_graphNode->setLineColor2(resolveColorSpec(m_lineColor2));
|
||||
}
|
||||
m_graphNode->setLineWidth(kGraphLineWidth * scale);
|
||||
|
||||
m_glyph->setGlyphSize(fontSize);
|
||||
m_glyph->setColor(resolveThemeColor(roleColor(ColorRole::OnSurface)));
|
||||
m_glyph->setColor(colorForRole(ColorRole::OnSurface));
|
||||
if (m_shadow) {
|
||||
m_glyph->setShadow(Color{0.0f, 0.0f, 0.0f, 0.5f}, 0.0f, 1.0f);
|
||||
}
|
||||
@@ -126,7 +126,7 @@ void DesktopSysmonWidget::doLayout(Renderer& renderer) {
|
||||
|
||||
if (m_label != nullptr) {
|
||||
m_label->setFontSize(fontSize);
|
||||
m_label->setColor(resolveThemeColor(roleColor(ColorRole::OnSurface)));
|
||||
m_label->setColor(colorForRole(ColorRole::OnSurface));
|
||||
m_label->measure(renderer);
|
||||
headerW += gap + m_label->width();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ enum class DesktopSysmonStat : std::uint8_t { CpuUsage, CpuTemp, RamPct, SwapPct
|
||||
class DesktopSysmonWidget : public DesktopWidget {
|
||||
public:
|
||||
DesktopSysmonWidget(SystemMonitorService* monitor, DesktopSysmonStat stat, std::optional<DesktopSysmonStat> stat2,
|
||||
ThemeColor lineColor, ThemeColor lineColor2, bool showLabel, bool shadow);
|
||||
ColorSpec lineColor, ColorSpec lineColor2, bool showLabel, bool shadow);
|
||||
~DesktopSysmonWidget() override;
|
||||
|
||||
void create() override;
|
||||
@@ -43,8 +43,8 @@ private:
|
||||
SystemMonitorService* m_monitor;
|
||||
DesktopSysmonStat m_stat;
|
||||
std::optional<DesktopSysmonStat> m_stat2;
|
||||
ThemeColor m_lineColor;
|
||||
ThemeColor m_lineColor2;
|
||||
ColorSpec m_lineColor;
|
||||
ColorSpec m_lineColor2;
|
||||
bool m_showLabel;
|
||||
bool m_shadow;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace {
|
||||
|
||||
} // namespace
|
||||
|
||||
DesktopWeatherWidget::DesktopWeatherWidget(const WeatherService* weather, ThemeColor color, bool shadow)
|
||||
DesktopWeatherWidget::DesktopWeatherWidget(const WeatherService* weather, ColorSpec color, bool shadow)
|
||||
: m_weather(weather), m_color(std::move(color)), m_shadow(shadow) {}
|
||||
|
||||
void DesktopWeatherWidget::create() {
|
||||
|
||||
@@ -11,7 +11,7 @@ class WeatherService;
|
||||
|
||||
class DesktopWeatherWidget : public DesktopWidget {
|
||||
public:
|
||||
DesktopWeatherWidget(const WeatherService* weather, ThemeColor color, bool shadow);
|
||||
DesktopWeatherWidget(const WeatherService* weather, ColorSpec color, bool shadow);
|
||||
|
||||
void create() override;
|
||||
|
||||
@@ -22,7 +22,7 @@ private:
|
||||
void applyShadow();
|
||||
|
||||
const WeatherService* m_weather = nullptr;
|
||||
ThemeColor m_color;
|
||||
ColorSpec m_color;
|
||||
bool m_shadow;
|
||||
|
||||
Glyph* m_glyph = nullptr;
|
||||
|
||||
@@ -399,7 +399,7 @@ bool Dock::onPointerEvent(const PointerEvent& event) {
|
||||
if (item.hovered) {
|
||||
item.hovered = false;
|
||||
if (item.background != nullptr) {
|
||||
item.background->setFill(clearThemeColor());
|
||||
item.background->setFill(clearColorSpec());
|
||||
}
|
||||
if (m_hoveredInstance->sceneRoot) {
|
||||
m_hoveredInstance->sceneRoot->markPaintDirty();
|
||||
@@ -898,8 +898,8 @@ void Dock::applyPanelPalette(DockInstance& instance) {
|
||||
if (instance.panel == nullptr)
|
||||
return;
|
||||
const float opacity = m_config->config().dock.backgroundOpacity;
|
||||
instance.panel->setFill(roleColor(ColorRole::Surface, opacity));
|
||||
instance.panel->setBorder(roleColor(ColorRole::Outline), 0.0f);
|
||||
instance.panel->setFill(colorSpecFromRole(ColorRole::Surface, opacity));
|
||||
instance.panel->setBorder(colorSpecFromRole(ColorRole::Outline), 0.0f);
|
||||
}
|
||||
|
||||
// ── Private: item population ──────────────────────────────────────────────────
|
||||
@@ -1003,7 +1003,7 @@ void Dock::rebuildItems(DockInstance& instance) {
|
||||
bg->setSize(cellMain, cellMain); // square — excludes indicator strip
|
||||
bg->setPosition(0.0f, 0.0f);
|
||||
bg->setRadius(static_cast<float>(cfg.radius));
|
||||
bg->setFill(clearThemeColor());
|
||||
bg->setFill(clearColorSpec());
|
||||
item.background = static_cast<Box*>(areaNode->addChild(std::move(bg)));
|
||||
|
||||
// Icon centred inside the padded cell.
|
||||
@@ -1022,7 +1022,7 @@ void Dock::rebuildItems(DockInstance& instance) {
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph("apps");
|
||||
glyph->setGlyphSize(iSize * 0.8f);
|
||||
glyph->setColor(roleColor(ColorRole::OnSurface));
|
||||
glyph->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
glyph->setSize(iSize, iSize);
|
||||
glyph->setPosition(kCellPad, kCellPad);
|
||||
item.iconGlyph = static_cast<Glyph*>(areaNode->addChild(std::move(glyph)));
|
||||
@@ -1057,7 +1057,7 @@ void Dock::rebuildItems(DockInstance& instance) {
|
||||
if (!itemPtr->hovered) {
|
||||
itemPtr->hovered = true;
|
||||
if (itemPtr->background) {
|
||||
itemPtr->background->setFill(roleColor(ColorRole::Hover, 0.8f));
|
||||
itemPtr->background->setFill(colorSpecFromRole(ColorRole::Hover, 0.8f));
|
||||
}
|
||||
if (instPtr->sceneRoot)
|
||||
instPtr->sceneRoot->markPaintDirty();
|
||||
@@ -1067,7 +1067,7 @@ void Dock::rebuildItems(DockInstance& instance) {
|
||||
if (itemPtr->hovered) {
|
||||
itemPtr->hovered = false;
|
||||
if (itemPtr->background) {
|
||||
itemPtr->background->setFill(clearThemeColor());
|
||||
itemPtr->background->setFill(clearColorSpec());
|
||||
}
|
||||
if (instPtr->sceneRoot)
|
||||
instPtr->sceneRoot->markPaintDirty();
|
||||
@@ -1178,8 +1178,8 @@ void Dock::updateVisuals(DockInstance& instance) {
|
||||
if (show) {
|
||||
const std::string label = (count > 9) ? "9+" : std::to_string(count);
|
||||
item.badgeLabel->setText(label);
|
||||
item.badgeLabel->setColor(roleColor(ColorRole::OnPrimary));
|
||||
item.badge->setFill(roleColor(ColorRole::Primary));
|
||||
item.badgeLabel->setColor(colorSpecFromRole(ColorRole::OnPrimary));
|
||||
item.badge->setFill(colorSpecFromRole(ColorRole::Primary));
|
||||
if (m_renderContext != nullptr) {
|
||||
const float bd = std::max(kBadgeMinSize, static_cast<float>(cfg.iconSize) * kBadgeSizeRatio);
|
||||
item.badgeLabel->measure(*m_renderContext);
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace {
|
||||
|
||||
auto actionLabel = std::make_unique<Label>();
|
||||
actionLabel->setFontSize(kIconSize * scale);
|
||||
actionLabel->setColor(roleColor(ColorRole::OnSurface));
|
||||
actionLabel->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
actionLabel->setVisible(false);
|
||||
m_actionLabel = static_cast<Label*>(m_row->addChild(std::move(actionLabel)));
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace {
|
||||
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyphSize(kIconSize * scale);
|
||||
glyph->setColor(roleColor(ColorRole::OnSurface));
|
||||
glyph->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
glyph->setVisible(false);
|
||||
m_glyph = static_cast<Glyph*>(m_row->addChild(std::move(glyph)));
|
||||
|
||||
@@ -130,13 +130,13 @@ namespace {
|
||||
auto title = std::make_unique<Label>();
|
||||
title->setFontSize(Style::fontSizeBody * scale);
|
||||
title->setBold(true);
|
||||
title->setColor(roleColor(ColorRole::OnSurface));
|
||||
title->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
m_title = static_cast<Label*>(m_textCol->addChild(std::move(title)));
|
||||
|
||||
auto subtitle = std::make_unique<Label>();
|
||||
subtitle->setCaptionStyle();
|
||||
subtitle->setFontSize(Style::fontSizeCaption * scale);
|
||||
subtitle->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
subtitle->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_subtitle = static_cast<Label*>(m_textCol->addChild(std::move(subtitle)));
|
||||
|
||||
setVisible(false);
|
||||
@@ -257,9 +257,9 @@ namespace {
|
||||
private:
|
||||
void applyVisualState() {
|
||||
if (m_selected) {
|
||||
m_row->setFill(roleColor(ColorRole::SurfaceVariant));
|
||||
m_row->setFill(colorSpecFromRole(ColorRole::SurfaceVariant));
|
||||
} else if (m_hovered) {
|
||||
m_row->setFill(roleColor(ColorRole::SurfaceVariant, 0.45f));
|
||||
m_row->setFill(colorSpecFromRole(ColorRole::SurfaceVariant, 0.45f));
|
||||
} else {
|
||||
m_row->setFill(rgba(0, 0, 0, 0));
|
||||
}
|
||||
@@ -340,7 +340,7 @@ void LauncherPanel::create() {
|
||||
m_resultsRoot = static_cast<Node*>(m_list->addChild(std::move(resultsRoot)));
|
||||
auto emptyLabel = std::make_unique<Label>();
|
||||
emptyLabel->setCaptionStyle();
|
||||
emptyLabel->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
emptyLabel->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
emptyLabel->setVisible(false);
|
||||
m_emptyLabel = static_cast<Label*>(m_resultsRoot->addChild(std::move(emptyLabel)));
|
||||
container->addChild(std::move(scrollView));
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace {
|
||||
if (!config.fillColor) {
|
||||
return rgba(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
return resolveThemeColor(*config.fillColor);
|
||||
return resolveColorSpec(*config.fillColor);
|
||||
}
|
||||
|
||||
const ext_session_lock_v1_listener kSessionLockListener = {
|
||||
|
||||
@@ -52,7 +52,7 @@ LockSurface::LockSurface(WaylandConnection& connection) : Surface(connection) {
|
||||
m_clockShadow = static_cast<Label*>(m_root.addChild(std::move(clockShadow)));
|
||||
|
||||
auto clock = std::make_unique<Label>();
|
||||
clock->setColor(roleColor(ColorRole::Primary));
|
||||
clock->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
m_clock = static_cast<Label*>(m_root.addChild(std::move(clock)));
|
||||
|
||||
auto loginPanel = std::make_unique<RectNode>();
|
||||
@@ -338,7 +338,7 @@ void LockSurface::layoutScene(std::uint32_t width, std::uint32_t height) {
|
||||
m_clockShadow->setVisible(m_clockShadowEnabled);
|
||||
m_clockShadow->setFontSize(kClockFontSize);
|
||||
m_clockShadow->setBold(true);
|
||||
m_clockShadow->setColor(roleColor(ColorRole::Shadow, 0.55f));
|
||||
m_clockShadow->setColor(colorSpecFromRole(ColorRole::Shadow, 0.55f));
|
||||
m_clockShadow->setText(m_clock->text());
|
||||
m_clockShadow->measure(*renderer);
|
||||
m_clockShadow->setPosition(clockX + 3.0f, clockY + 4.0f);
|
||||
@@ -347,8 +347,8 @@ void LockSurface::layoutScene(std::uint32_t width, std::uint32_t height) {
|
||||
m_loginPanel->setPosition(panelX, panelY);
|
||||
m_loginPanel->setSize(panelWidth, panelHeight);
|
||||
m_loginPanel->setStyle(RoundedRectStyle{
|
||||
.fill = resolveThemeColor(roleColor(ColorRole::SurfaceVariant, 0.88f)),
|
||||
.border = resolveThemeColor(roleColor(ColorRole::Outline, 0.95f)),
|
||||
.fill = colorForRole(ColorRole::SurfaceVariant, 0.88f),
|
||||
.border = colorForRole(ColorRole::Outline, 0.95f),
|
||||
.fillMode = FillMode::Solid,
|
||||
.radius = Style::radiusXl,
|
||||
.softness = 1.0f,
|
||||
|
||||
@@ -715,10 +715,10 @@ void NotificationToast::addCardToInstance(Instance& inst, std::size_t entryIndex
|
||||
// Hover wiring: pause countdown while the card is hovered, and brighten the (X).
|
||||
// On leave, resume the countdown from the remaining progress.
|
||||
const bool isCritical = (entry.urgency == Urgency::Critical);
|
||||
const Color closeColorNormal =
|
||||
resolveThemeColor(isCritical ? roleColor(ColorRole::Error, 0.75f) : roleColor(ColorRole::OnSurfaceVariant, 0.6f));
|
||||
const Color closeColorNormal = resolveColorSpec(isCritical ? colorSpecFromRole(ColorRole::Error, 0.75f)
|
||||
: colorSpecFromRole(ColorRole::OnSurfaceVariant, 0.6f));
|
||||
const Color closeColorHover =
|
||||
resolveThemeColor(isCritical ? roleColor(ColorRole::Error) : roleColor(ColorRole::OnSurface));
|
||||
resolveColorSpec(isCritical ? colorSpecFromRole(ColorRole::Error) : colorSpecFromRole(ColorRole::OnSurface));
|
||||
const int totalDuration = entry.displayDurationMs;
|
||||
const uint32_t notificationId = entry.notificationId;
|
||||
Glyph* closeGlyphPtr = cs.closeGlyph;
|
||||
@@ -1477,11 +1477,11 @@ InputArea* NotificationToast::buildCard(const PopupEntry& entry, Node** outCardC
|
||||
bg->setRadius(Style::radiusXl);
|
||||
if (isCritical) {
|
||||
// Keep critical toasts readable: surface background + urgent border.
|
||||
bg->setFill(roleColor(ColorRole::Surface, bgAlpha));
|
||||
bg->setBorder(roleColor(ColorRole::Error, 0.95f), Style::borderWidth * 1.4f);
|
||||
bg->setFill(colorSpecFromRole(ColorRole::Surface, bgAlpha));
|
||||
bg->setBorder(colorSpecFromRole(ColorRole::Error, 0.95f), Style::borderWidth * 1.4f);
|
||||
} else {
|
||||
bg->setFill(roleColor(ColorRole::Surface, bgAlpha));
|
||||
bg->setBorder(roleColor(ColorRole::Outline, 0.8f), Style::borderWidth);
|
||||
bg->setFill(colorSpecFromRole(ColorRole::Surface, bgAlpha));
|
||||
bg->setBorder(colorSpecFromRole(ColorRole::Outline, 0.8f), Style::borderWidth);
|
||||
}
|
||||
bg->setSize(kCardWidth, cardHeight);
|
||||
*outBg = cardRoot->addChild(std::move(bg));
|
||||
@@ -1549,7 +1549,7 @@ InputArea* NotificationToast::buildCard(const PopupEntry& entry, Node** outCardC
|
||||
auto fallback = std::make_unique<Glyph>();
|
||||
fallback->setGlyph("bell");
|
||||
fallback->setGlyphSize(kNotificationIconGlyphSize);
|
||||
fallback->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
fallback->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
fallback->measure(*m_renderContext);
|
||||
fallback->setPosition(std::round((kNotificationIconSize - fallback->width()) * 0.5f),
|
||||
std::round((kNotificationIconSize - fallback->height()) * 0.5f));
|
||||
@@ -1561,7 +1561,7 @@ InputArea* NotificationToast::buildCard(const PopupEntry& entry, Node** outCardC
|
||||
auto appName = std::make_unique<Label>();
|
||||
appName->setText(entry.appName);
|
||||
appName->setFontSize(kMetaFontSize);
|
||||
appName->setColor(roleColor(isCritical ? ColorRole::Error : ColorRole::OnSurfaceVariant));
|
||||
appName->setColor(colorSpecFromRole(isCritical ? ColorRole::Error : ColorRole::OnSurfaceVariant));
|
||||
appName->setMaxWidth(innerWidth - kCloseButtonSize - Style::spaceXs);
|
||||
appName->measure(*m_renderContext);
|
||||
*outAppName = appName.get();
|
||||
@@ -1572,8 +1572,8 @@ InputArea* NotificationToast::buildCard(const PopupEntry& entry, Node** outCardC
|
||||
auto closeGlyph = std::make_unique<Glyph>();
|
||||
closeGlyph->setGlyph("close");
|
||||
closeGlyph->setGlyphSize(kCloseGlyphSize);
|
||||
closeGlyph->setColor(resolveThemeColor(isCritical ? roleColor(ColorRole::Error, 0.75f)
|
||||
: roleColor(ColorRole::OnSurfaceVariant, 0.6f)));
|
||||
closeGlyph->setColor(resolveColorSpec(isCritical ? colorSpecFromRole(ColorRole::Error, 0.75f)
|
||||
: colorSpecFromRole(ColorRole::OnSurfaceVariant, 0.6f)));
|
||||
*outCloseGlyph = static_cast<Glyph*>(headerRow->addChild(std::move(closeGlyph)));
|
||||
headerRow->layout(*m_renderContext);
|
||||
|
||||
@@ -1583,7 +1583,7 @@ InputArea* NotificationToast::buildCard(const PopupEntry& entry, Node** outCardC
|
||||
auto summary = std::make_unique<Label>();
|
||||
summary->setText(entry.summary);
|
||||
summary->setFontSize(kSummaryFontSize);
|
||||
summary->setColor(roleColor(ColorRole::OnSurface));
|
||||
summary->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
summary->setBold(true);
|
||||
summary->setMaxWidth(textMaxWidth);
|
||||
std::unique_ptr<Flex> actionsRow;
|
||||
@@ -1670,7 +1670,7 @@ InputArea* NotificationToast::buildCard(const PopupEntry& entry, Node** outCardC
|
||||
auto body = std::make_unique<Label>();
|
||||
body->setText(entry.body);
|
||||
body->setFontSize(kBodyFontSize);
|
||||
body->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
body->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
body->setMaxWidth(textMaxWidth);
|
||||
const float bodyHeight = availableBodyHeight(summaryMeasuredH, actionsReservedHeight, cardHeight);
|
||||
const int bodyLines = entry.toastBodyLines;
|
||||
@@ -1691,8 +1691,8 @@ InputArea* NotificationToast::buildCard(const PopupEntry& entry, Node** outCardC
|
||||
|
||||
// Progress bar (countdown)
|
||||
auto progressBar = std::make_unique<ProgressBar>();
|
||||
progressBar->setTrackColor(roleColor(ColorRole::OnSurfaceVariant, 0.35f));
|
||||
progressBar->setFillColor(roleColor(isCritical ? ColorRole::Error : ColorRole::Primary));
|
||||
progressBar->setTrackColor(colorSpecFromRole(ColorRole::OnSurfaceVariant, 0.35f));
|
||||
progressBar->setFillColor(colorSpecFromRole(isCritical ? ColorRole::Error : ColorRole::Primary));
|
||||
progressBar->setSize(innerWidth, kProgressHeight);
|
||||
progressBar->setPosition(kCardInnerPad, progressY);
|
||||
*outProgress = static_cast<ProgressBar*>(foreground->addChild(std::move(progressBar)));
|
||||
|
||||
@@ -276,8 +276,8 @@ void OsdOverlay::buildScene(Instance& inst, std::uint32_t width, std::uint32_t h
|
||||
|
||||
auto background = std::make_unique<Box>();
|
||||
background->setCardStyle();
|
||||
background->setFill(roleColor(ColorRole::Surface));
|
||||
background->setBorder(roleColor(ColorRole::Outline), border);
|
||||
background->setFill(colorSpecFromRole(ColorRole::Surface));
|
||||
background->setBorder(colorSpecFromRole(ColorRole::Outline), border);
|
||||
background->setRadius(ch * 0.5f);
|
||||
background->setSize(cw, ch);
|
||||
background->setPosition(cardX, cardY);
|
||||
@@ -302,7 +302,7 @@ void OsdOverlay::buildScene(Instance& inst, std::uint32_t width, std::uint32_t h
|
||||
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyphSize(glyphSize(s));
|
||||
glyph->setColor(roleColor(ColorRole::Primary));
|
||||
glyph->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
inst.glyph = glyph.get();
|
||||
inst.glyph->setZIndex(1);
|
||||
inst.row->addChild(std::move(glyph));
|
||||
@@ -310,7 +310,7 @@ void OsdOverlay::buildScene(Instance& inst, std::uint32_t width, std::uint32_t h
|
||||
auto value = std::make_unique<Label>();
|
||||
value->setBold(true);
|
||||
value->setFontSize(valueFontSize(s));
|
||||
value->setColor(roleColor(ColorRole::OnSurface));
|
||||
value->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
value->setTextAlign(TextAlign::End);
|
||||
// Reserve enough width for "100%" so the progress bar doesn't shrink at max values.
|
||||
value->setText("100%");
|
||||
@@ -321,8 +321,8 @@ void OsdOverlay::buildScene(Instance& inst, std::uint32_t width, std::uint32_t h
|
||||
|
||||
const float ph = progressHeight(s);
|
||||
auto progress = std::make_unique<ProgressBar>();
|
||||
progress->setTrack(roleColor(ColorRole::SurfaceVariant));
|
||||
progress->setFill(roleColor(ColorRole::Primary));
|
||||
progress->setTrack(colorSpecFromRole(ColorRole::SurfaceVariant));
|
||||
progress->setFill(colorSpecFromRole(ColorRole::Primary));
|
||||
progress->setFlexGrow(1.0f);
|
||||
progress->setSize(0.0f, ph);
|
||||
progress->setRadius(ph * 0.5f);
|
||||
|
||||
@@ -1090,7 +1090,7 @@ void PanelManager::applyAttachedDecorationStyle() {
|
||||
|
||||
if (m_bgNode != nullptr) {
|
||||
auto* bg = static_cast<Box*>(m_bgNode);
|
||||
bg->setFill(roleColor(ColorRole::Surface, m_attachedBackgroundOpacity));
|
||||
bg->setFill(colorSpecFromRole(ColorRole::Surface, m_attachedBackgroundOpacity));
|
||||
}
|
||||
|
||||
if (m_panelShadowNode != nullptr && m_config != nullptr) {
|
||||
|
||||
@@ -69,13 +69,13 @@ void PolkitPanel::create() {
|
||||
title->setText(i18n::tr("auth.polkit.title"));
|
||||
title->setBold(true);
|
||||
title->setFontSize(Style::fontSizeTitle * scale);
|
||||
title->setColor(roleColor(ColorRole::Primary));
|
||||
title->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
m_titleLabel = title.get();
|
||||
topContent->addChild(std::move(title));
|
||||
|
||||
auto message = std::make_unique<Label>();
|
||||
message->setFontSize(Style::fontSizeBody * scale);
|
||||
message->setColor(roleColor(ColorRole::OnSurface));
|
||||
message->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
message->setMaxLines(6);
|
||||
m_messageLabel = message.get();
|
||||
topContent->addChild(std::move(message));
|
||||
@@ -88,7 +88,7 @@ void PolkitPanel::create() {
|
||||
|
||||
auto prompt = std::make_unique<Label>();
|
||||
prompt->setFontSize(Style::fontSizeBody * scale);
|
||||
prompt->setColor(roleColor(ColorRole::OnSurface));
|
||||
prompt->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
prompt->setMaxLines(3);
|
||||
m_promptLabel = prompt.get();
|
||||
bottomContent->addChild(std::move(prompt));
|
||||
@@ -104,7 +104,7 @@ void PolkitPanel::create() {
|
||||
|
||||
auto supplementary = std::make_unique<Label>();
|
||||
supplementary->setFontSize(Style::fontSizeCaption * scale);
|
||||
supplementary->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
supplementary->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
supplementary->setMaxLines(4);
|
||||
m_supplementaryLabel = supplementary.get();
|
||||
bottomContent->addChild(std::move(supplementary));
|
||||
@@ -188,11 +188,12 @@ void PolkitPanel::doUpdate(Renderer& /*renderer*/) {
|
||||
}
|
||||
m_messageLabel->setText(wrapLongRuns(request.message.empty() ? request.actionId : request.message));
|
||||
m_promptLabel->setText(promptText);
|
||||
m_promptLabel->setColor(isInvalidPassword ? roleColor(ColorRole::Error) : roleColor(ColorRole::OnSurface));
|
||||
m_promptLabel->setColor(isInvalidPassword ? colorSpecFromRole(ColorRole::Error)
|
||||
: colorSpecFromRole(ColorRole::OnSurface));
|
||||
m_promptLabel->setVisible(!promptText.empty());
|
||||
m_supplementaryLabel->setText(supplementaryText);
|
||||
m_supplementaryLabel->setVisible(!supplementaryText.empty());
|
||||
m_supplementaryLabel->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_supplementaryLabel->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_submitButton->setEnabled(agent->isResponseRequired());
|
||||
}
|
||||
|
||||
|
||||
@@ -52,8 +52,7 @@ namespace settings {
|
||||
std::shared_ptr<std::vector<Flex*>> itemNodes;
|
||||
};
|
||||
|
||||
std::unique_ptr<Label> makeLabel(std::string_view text, float fontSize, const ThemeColor& color,
|
||||
bool bold = false) {
|
||||
std::unique_ptr<Label> makeLabel(std::string_view text, float fontSize, const ColorSpec& color, bool bold = false) {
|
||||
auto label = std::make_unique<Label>();
|
||||
label->setText(text);
|
||||
label->setFontSize(fontSize);
|
||||
@@ -176,16 +175,16 @@ namespace settings {
|
||||
return true;
|
||||
}
|
||||
|
||||
ThemeColor widgetBadgeColor(WidgetReferenceKind kind) {
|
||||
ColorSpec widgetBadgeColor(WidgetReferenceKind kind) {
|
||||
switch (kind) {
|
||||
case WidgetReferenceKind::BuiltIn:
|
||||
return roleColor(ColorRole::Primary, 0.16f);
|
||||
return colorSpecFromRole(ColorRole::Primary, 0.16f);
|
||||
case WidgetReferenceKind::Named:
|
||||
return roleColor(ColorRole::Secondary, 0.18f);
|
||||
return colorSpecFromRole(ColorRole::Secondary, 0.18f);
|
||||
case WidgetReferenceKind::Unknown:
|
||||
return roleColor(ColorRole::Error, 0.16f);
|
||||
return colorSpecFromRole(ColorRole::Error, 0.16f);
|
||||
}
|
||||
return roleColor(ColorRole::OnSurfaceVariant, 0.12f);
|
||||
return colorSpecFromRole(ColorRole::OnSurfaceVariant, 0.12f);
|
||||
}
|
||||
|
||||
const WidgetTypeSpec* widgetTypeSpecForType(std::string_view type) {
|
||||
@@ -629,9 +628,10 @@ namespace settings {
|
||||
header->setGap(1.0f * ctx.scale);
|
||||
header->setPadding(Style::spaceXs * ctx.scale, 0.0f);
|
||||
header->addChild(makeLabel(i18n::tr("settings.entities.widget.raw.title"), Style::fontSizeCaption * ctx.scale,
|
||||
roleColor(ColorRole::OnSurface), true));
|
||||
colorSpecFromRole(ColorRole::OnSurface), true));
|
||||
header->addChild(makeLabel(i18n::tr("settings.entities.widget.raw.description"),
|
||||
Style::fontSizeCaption * ctx.scale, roleColor(ColorRole::OnSurfaceVariant), false));
|
||||
Style::fontSizeCaption * ctx.scale, colorSpecFromRole(ColorRole::OnSurfaceVariant),
|
||||
false));
|
||||
panel.addChild(std::move(header));
|
||||
|
||||
for (const auto& key : rawKeys) {
|
||||
@@ -651,14 +651,15 @@ namespace settings {
|
||||
row->setPadding(Style::spaceXs * ctx.scale, 0.0f);
|
||||
row->setMinHeight(Style::controlHeightSm * ctx.scale);
|
||||
|
||||
row->addChild(makeLabel(key, Style::fontSizeCaption * ctx.scale, roleColor(ColorRole::OnSurface), true));
|
||||
row->addChild(
|
||||
makeLabel(key, Style::fontSizeCaption * ctx.scale, colorSpecFromRole(ColorRole::OnSurface), true));
|
||||
|
||||
auto spacer = std::make_unique<Flex>();
|
||||
spacer->setFlexGrow(1.0f);
|
||||
row->addChild(std::move(spacer));
|
||||
|
||||
row->addChild(makeLabel(settingValueAsDisplayString(valueIt->second), Style::fontSizeCaption * ctx.scale,
|
||||
roleColor(ColorRole::OnSurfaceVariant), false));
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant), false));
|
||||
|
||||
if (overridden) {
|
||||
auto deleteBtn = std::make_unique<Button>();
|
||||
@@ -718,9 +719,10 @@ namespace settings {
|
||||
copy->setGap(Style::spaceXs * ctx.scale);
|
||||
copy->setFlexGrow(1.0f);
|
||||
copy->addChild(makeLabel(i18n::tr("settings.widgets.settings.type.label"), Style::fontSizeBody * ctx.scale,
|
||||
roleColor(ColorRole::OnSurface), false));
|
||||
auto detail = makeLabel(i18n::tr("settings.widgets.settings.type.description"),
|
||||
Style::fontSizeCaption * ctx.scale, roleColor(ColorRole::OnSurfaceVariant), false);
|
||||
colorSpecFromRole(ColorRole::OnSurface), false));
|
||||
auto detail =
|
||||
makeLabel(i18n::tr("settings.widgets.settings.type.description"), Style::fontSizeCaption * ctx.scale,
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant), false);
|
||||
detail->setMaxWidth(360.0f * ctx.scale);
|
||||
copy->addChild(std::move(detail));
|
||||
row->addChild(std::move(copy));
|
||||
@@ -747,17 +749,18 @@ namespace settings {
|
||||
panel->setGap(Style::spaceXs * ctx.scale);
|
||||
panel->setPadding(Style::spaceSm * ctx.scale);
|
||||
panel->setRadius(Style::radiusSm * ctx.scale);
|
||||
panel->setFill(roleColor(ColorRole::SurfaceVariant, 0.55f));
|
||||
panel->setBorder(roleColor(ColorRole::Outline, 0.22f), Style::borderWidth);
|
||||
panel->setFill(colorSpecFromRole(ColorRole::SurfaceVariant, 0.55f));
|
||||
panel->setBorder(colorSpecFromRole(ColorRole::Outline, 0.22f), Style::borderWidth);
|
||||
|
||||
auto panelHeader = std::make_unique<Flex>();
|
||||
panelHeader->setDirection(FlexDirection::Horizontal);
|
||||
panelHeader->setAlign(FlexAlign::Center);
|
||||
panelHeader->setGap(Style::spaceXs * ctx.scale);
|
||||
panelHeader->addChild(makeLabel(i18n::tr("settings.entities.widget.settings.title"),
|
||||
Style::fontSizeCaption * ctx.scale, roleColor(ColorRole::OnSurface), true));
|
||||
panelHeader->addChild(
|
||||
makeLabel(widgetType, Style::fontSizeCaption * ctx.scale, roleColor(ColorRole::OnSurfaceVariant), false));
|
||||
Style::fontSizeCaption * ctx.scale, colorSpecFromRole(ColorRole::OnSurface),
|
||||
true));
|
||||
panelHeader->addChild(makeLabel(widgetType, Style::fontSizeCaption * ctx.scale,
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant), false));
|
||||
panel->addChild(std::move(panelHeader));
|
||||
|
||||
std::size_t visibleSpecs = 0;
|
||||
@@ -839,7 +842,8 @@ namespace settings {
|
||||
|
||||
if (visibleSpecs == 0) {
|
||||
panel->addChild(makeLabel(i18n::tr("settings.entities.widget.settings.empty"),
|
||||
Style::fontSizeCaption * ctx.scale, roleColor(ColorRole::OnSurfaceVariant), false));
|
||||
Style::fontSizeCaption * ctx.scale, colorSpecFromRole(ColorRole::OnSurfaceVariant),
|
||||
false));
|
||||
}
|
||||
|
||||
item.addChild(std::move(panel));
|
||||
@@ -856,8 +860,8 @@ namespace settings {
|
||||
inspector->setGap(Style::spaceSm * ctx.scale);
|
||||
inspector->setPadding(Style::spaceMd * ctx.scale);
|
||||
inspector->setRadius(Style::radiusMd * ctx.scale);
|
||||
inspector->setFill(roleColor(ColorRole::Surface, 0.85f));
|
||||
inspector->setBorder(roleColor(ColorRole::Outline, 0.35f), Style::borderWidth);
|
||||
inspector->setFill(colorSpecFromRole(ColorRole::Surface, 0.85f));
|
||||
inspector->setBorder(colorSpecFromRole(ColorRole::Outline, 0.35f), Style::borderWidth);
|
||||
|
||||
if (hasEdit) {
|
||||
const std::string widgetName = ctx.editingWidgetName;
|
||||
@@ -886,10 +890,10 @@ namespace settings {
|
||||
headerRow->setAlign(FlexAlign::Center);
|
||||
headerRow->setGap(Style::spaceSm * ctx.scale);
|
||||
headerRow->addChild(makeLabel(i18n::tr("settings.entities.widget.inspector.edit-title"),
|
||||
Style::fontSizeCaption * ctx.scale, roleColor(ColorRole::OnSurfaceVariant),
|
||||
true));
|
||||
Style::fontSizeCaption * ctx.scale,
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant), true));
|
||||
headerRow->addChild(
|
||||
makeLabel(info.title, Style::fontSizeBody * ctx.scale, roleColor(ColorRole::OnSurface), true));
|
||||
makeLabel(info.title, Style::fontSizeBody * ctx.scale, colorSpecFromRole(ColorRole::OnSurface), true));
|
||||
|
||||
auto kindBadge = std::make_unique<Flex>();
|
||||
kindBadge->setAlign(FlexAlign::Center);
|
||||
@@ -897,7 +901,7 @@ namespace settings {
|
||||
kindBadge->setRadius(Style::radiusSm * ctx.scale);
|
||||
kindBadge->setFill(widgetBadgeColor(info.kind));
|
||||
kindBadge->addChild(
|
||||
makeLabel(info.badge, Style::fontSizeCaption * ctx.scale, roleColor(ColorRole::OnSurface), true));
|
||||
makeLabel(info.badge, Style::fontSizeCaption * ctx.scale, colorSpecFromRole(ColorRole::OnSurface), true));
|
||||
headerRow->addChild(std::move(kindBadge));
|
||||
|
||||
auto headerSpacer = std::make_unique<Flex>();
|
||||
@@ -997,15 +1001,15 @@ namespace settings {
|
||||
confirmPanel->setGap(Style::spaceXs * ctx.scale);
|
||||
confirmPanel->setPadding(Style::spaceSm * ctx.scale);
|
||||
confirmPanel->setRadius(Style::radiusSm * ctx.scale);
|
||||
confirmPanel->setFill(roleColor(ColorRole::Error, 0.10f));
|
||||
confirmPanel->setBorder(roleColor(ColorRole::Error, 0.35f), Style::borderWidth);
|
||||
confirmPanel->setFill(colorSpecFromRole(ColorRole::Error, 0.10f));
|
||||
confirmPanel->setBorder(colorSpecFromRole(ColorRole::Error, 0.35f), Style::borderWidth);
|
||||
|
||||
confirmPanel->addChild(
|
||||
makeLabel(i18n::tr("settings.entities.widget.instance.delete-confirm-title", "name", widgetName),
|
||||
Style::fontSizeBody * ctx.scale, roleColor(ColorRole::Error), true));
|
||||
Style::fontSizeBody * ctx.scale, colorSpecFromRole(ColorRole::Error), true));
|
||||
confirmPanel->addChild(makeLabel(i18n::tr("settings.entities.widget.instance.delete-confirm-desc"),
|
||||
Style::fontSizeCaption * ctx.scale, roleColor(ColorRole::OnSurfaceVariant),
|
||||
false));
|
||||
Style::fontSizeCaption * ctx.scale,
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant), false));
|
||||
|
||||
auto confirmRow = std::make_unique<Flex>();
|
||||
confirmRow->setDirection(FlexDirection::Horizontal);
|
||||
@@ -1160,7 +1164,7 @@ namespace settings {
|
||||
headerRow->setGap(Style::spaceSm * ctx.scale);
|
||||
headerRow->addChild(
|
||||
makeLabel(i18n::tr("settings.entities.widget.inspector.add-title", "lane", laneLabel(targetLaneKey)),
|
||||
Style::fontSizeBody * ctx.scale, roleColor(ColorRole::OnSurface), true));
|
||||
Style::fontSizeBody * ctx.scale, colorSpecFromRole(ColorRole::OnSurface), true));
|
||||
|
||||
auto headerSpacer = std::make_unique<Flex>();
|
||||
headerSpacer->setFlexGrow(1.0f);
|
||||
@@ -1188,8 +1192,8 @@ namespace settings {
|
||||
if (!ctx.creatingWidgetType.empty()) {
|
||||
const std::string widgetType = ctx.creatingWidgetType;
|
||||
inspector->addChild(makeLabel(i18n::tr("settings.entities.widget.instance.create-title", "type", widgetType),
|
||||
Style::fontSizeCaption * ctx.scale, roleColor(ColorRole::OnSurfaceVariant),
|
||||
false));
|
||||
Style::fontSizeCaption * ctx.scale,
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant), false));
|
||||
|
||||
auto createRow = std::make_unique<Flex>();
|
||||
createRow->setDirection(FlexDirection::Horizontal);
|
||||
@@ -1329,11 +1333,12 @@ namespace settings {
|
||||
titleRow->setAlign(FlexAlign::Center);
|
||||
titleRow->setGap(Style::spaceSm * ctx.scale);
|
||||
titleRow->addChild(makeLabel(i18n::tr("settings.entities.widget.editor.title"), Style::fontSizeBody * ctx.scale,
|
||||
roleColor(ColorRole::OnSurface), false));
|
||||
colorSpecFromRole(ColorRole::OnSurface), false));
|
||||
block->addChild(std::move(titleRow));
|
||||
|
||||
block->addChild(makeLabel(i18n::tr("settings.entities.widget.editor.description"),
|
||||
Style::fontSizeCaption * ctx.scale, roleColor(ColorRole::OnSurfaceVariant), false));
|
||||
Style::fontSizeCaption * ctx.scale, colorSpecFromRole(ColorRole::OnSurfaceVariant),
|
||||
false));
|
||||
|
||||
const bool inspectorActive = !ctx.editingWidgetName.empty() || !ctx.openWidgetPickerPath.empty();
|
||||
if (inspectorActive) {
|
||||
@@ -1365,14 +1370,14 @@ namespace settings {
|
||||
lane->setGap(Style::spaceXs * ctx.scale);
|
||||
lane->setPadding(Style::spaceSm * ctx.scale);
|
||||
lane->setRadius(Style::radiusMd * ctx.scale);
|
||||
lane->setFill(roleColor(ColorRole::SurfaceVariant, 0.45f));
|
||||
lane->setBorder(roleColor(ColorRole::Outline, 0.35f), Style::borderWidth);
|
||||
lane->setFill(colorSpecFromRole(ColorRole::SurfaceVariant, 0.45f));
|
||||
lane->setBorder(colorSpecFromRole(ColorRole::Outline, 0.35f), Style::borderWidth);
|
||||
lane->setFlexGrow(1.0f);
|
||||
lane->setMinWidth(160.0f * ctx.scale);
|
||||
auto* lanePtr = lane.get();
|
||||
|
||||
auto dropIndicator = std::make_unique<Box>();
|
||||
dropIndicator->setFill(roleColor(ColorRole::Primary));
|
||||
dropIndicator->setFill(colorSpecFromRole(ColorRole::Primary));
|
||||
dropIndicator->setRadius(std::max(1.0f, 1.5f * ctx.scale));
|
||||
dropIndicator->setVisible(false);
|
||||
dropIndicator->setParticipatesInLayout(false);
|
||||
@@ -1393,16 +1398,16 @@ namespace settings {
|
||||
laneHeader->setDirection(FlexDirection::Horizontal);
|
||||
laneHeader->setAlign(FlexAlign::Center);
|
||||
laneHeader->setGap(Style::spaceXs * ctx.scale);
|
||||
laneHeader->addChild(
|
||||
makeLabel(laneLabel(laneKey), Style::fontSizeBody * ctx.scale, roleColor(ColorRole::OnSurface), true));
|
||||
laneHeader->addChild(makeLabel(laneLabel(laneKey), Style::fontSizeBody * ctx.scale,
|
||||
colorSpecFromRole(ColorRole::OnSurface), true));
|
||||
if (overridden) {
|
||||
auto badge = std::make_unique<Flex>();
|
||||
badge->setAlign(FlexAlign::Center);
|
||||
badge->setPadding(1.0f * ctx.scale, Style::spaceXs * ctx.scale);
|
||||
badge->setRadius(Style::radiusSm * ctx.scale);
|
||||
badge->setFill(roleColor(ColorRole::Primary, 0.15f));
|
||||
badge->setFill(colorSpecFromRole(ColorRole::Primary, 0.15f));
|
||||
badge->addChild(makeLabel(i18n::tr("settings.badges.override"), Style::fontSizeCaption * ctx.scale,
|
||||
roleColor(ColorRole::Primary), true));
|
||||
colorSpecFromRole(ColorRole::Primary), true));
|
||||
laneHeader->addChild(std::move(badge));
|
||||
}
|
||||
if (inherited) {
|
||||
@@ -1410,9 +1415,9 @@ namespace settings {
|
||||
badge->setAlign(FlexAlign::Center);
|
||||
badge->setPadding(1.0f * ctx.scale, Style::spaceXs * ctx.scale);
|
||||
badge->setRadius(Style::radiusSm * ctx.scale);
|
||||
badge->setFill(roleColor(ColorRole::OnSurfaceVariant, 0.14f));
|
||||
badge->setFill(colorSpecFromRole(ColorRole::OnSurfaceVariant, 0.14f));
|
||||
badge->addChild(makeLabel(i18n::tr("settings.badges.inherited"), Style::fontSizeCaption * ctx.scale,
|
||||
roleColor(ColorRole::OnSurfaceVariant), true));
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant), true));
|
||||
laneHeader->addChild(std::move(badge));
|
||||
}
|
||||
auto laneSpacer = std::make_unique<Flex>();
|
||||
@@ -1444,8 +1449,8 @@ namespace settings {
|
||||
item->setGap(Style::spaceXs * ctx.scale);
|
||||
item->setPadding(Style::spaceXs * ctx.scale, Style::spaceSm * ctx.scale);
|
||||
item->setRadius(Style::radiusSm * ctx.scale);
|
||||
item->setFill(roleColor(ColorRole::Surface, 0.72f));
|
||||
item->setBorder(roleColor(ColorRole::Outline, 0.22f), Style::borderWidth);
|
||||
item->setFill(colorSpecFromRole(ColorRole::Surface, 0.72f));
|
||||
item->setBorder(colorSpecFromRole(ColorRole::Outline, 0.22f), Style::borderWidth);
|
||||
auto* itemPtr = item.get();
|
||||
itemNodes->push_back(itemPtr);
|
||||
|
||||
@@ -1454,7 +1459,7 @@ namespace settings {
|
||||
itemTop->setAlign(FlexAlign::Center);
|
||||
itemTop->setGap(Style::spaceXs * ctx.scale);
|
||||
itemTop->addChild(
|
||||
makeLabel(info.title, Style::fontSizeCaption * ctx.scale, roleColor(ColorRole::OnSurface), true));
|
||||
makeLabel(info.title, Style::fontSizeCaption * ctx.scale, colorSpecFromRole(ColorRole::OnSurface), true));
|
||||
auto itemSpacer = std::make_unique<Flex>();
|
||||
itemSpacer->setFlexGrow(1.0f);
|
||||
itemTop->addChild(std::move(itemSpacer));
|
||||
@@ -1464,12 +1469,12 @@ namespace settings {
|
||||
kindBadge->setRadius(Style::radiusSm * ctx.scale);
|
||||
kindBadge->setFill(widgetBadgeColor(info.kind));
|
||||
kindBadge->addChild(
|
||||
makeLabel(info.badge, Style::fontSizeCaption * ctx.scale, roleColor(ColorRole::OnSurface), true));
|
||||
makeLabel(info.badge, Style::fontSizeCaption * ctx.scale, colorSpecFromRole(ColorRole::OnSurface), true));
|
||||
itemTop->addChild(std::move(kindBadge));
|
||||
item->addChild(std::move(itemTop));
|
||||
|
||||
item->addChild(
|
||||
makeLabel(info.detail, Style::fontSizeCaption * ctx.scale, roleColor(ColorRole::OnSurfaceVariant), false));
|
||||
item->addChild(makeLabel(info.detail, Style::fontSizeCaption * ctx.scale,
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant), false));
|
||||
|
||||
auto actions = std::make_unique<Flex>();
|
||||
actions->setDirection(FlexDirection::Horizontal);
|
||||
@@ -1655,14 +1660,14 @@ namespace settings {
|
||||
emptyState->setGap(2.0f * ctx.scale);
|
||||
emptyState->setPadding(Style::spaceMd * ctx.scale, Style::spaceSm * ctx.scale);
|
||||
emptyState->setRadius(Style::radiusSm * ctx.scale);
|
||||
emptyState->setFill(roleColor(ColorRole::SurfaceVariant, 0.25f));
|
||||
emptyState->setBorder(roleColor(ColorRole::Outline, 0.18f), Style::borderWidth);
|
||||
emptyState->setFill(colorSpecFromRole(ColorRole::SurfaceVariant, 0.25f));
|
||||
emptyState->setBorder(colorSpecFromRole(ColorRole::Outline, 0.18f), Style::borderWidth);
|
||||
emptyState->addChild(makeLabel(i18n::tr("settings.entities.widget.lanes.empty"),
|
||||
Style::fontSizeCaption * ctx.scale, roleColor(ColorRole::OnSurfaceVariant),
|
||||
true));
|
||||
Style::fontSizeCaption * ctx.scale,
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant), true));
|
||||
emptyState->addChild(makeLabel(i18n::tr("settings.entities.widget.lanes.empty-hint"),
|
||||
Style::fontSizeCaption * ctx.scale, roleColor(ColorRole::OnSurfaceVariant),
|
||||
false));
|
||||
Style::fontSizeCaption * ctx.scale,
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant), false));
|
||||
lane->addChild(std::move(emptyState));
|
||||
}
|
||||
|
||||
|
||||
@@ -39,8 +39,7 @@
|
||||
namespace settings {
|
||||
namespace {
|
||||
|
||||
std::unique_ptr<Label> makeLabel(std::string_view text, float fontSize, const ThemeColor& color,
|
||||
bool bold = false) {
|
||||
std::unique_ptr<Label> makeLabel(std::string_view text, float fontSize, const ColorSpec& color, bool bold = false) {
|
||||
auto label = std::make_unique<Label>();
|
||||
label->setText(text);
|
||||
label->setFontSize(fontSize);
|
||||
@@ -256,7 +255,7 @@ namespace settings {
|
||||
section->setGap(Style::spaceSm * scale);
|
||||
section->setPadding(Style::spaceLg * scale);
|
||||
section->setCardStyle(scale);
|
||||
section->setFill(roleColor(ColorRole::Surface));
|
||||
section->setFill(colorSpecFromRole(ColorRole::Surface));
|
||||
|
||||
auto titleRow = std::make_unique<Flex>();
|
||||
titleRow->setDirection(FlexDirection::Horizontal);
|
||||
@@ -266,10 +265,10 @@ namespace settings {
|
||||
auto titleGlyph = std::make_unique<Glyph>();
|
||||
titleGlyph->setGlyph(sectionGlyph(sectionKey));
|
||||
titleGlyph->setGlyphSize(Style::fontSizeHeader * scale);
|
||||
titleGlyph->setColor(roleColor(ColorRole::Primary));
|
||||
titleGlyph->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
titleRow->addChild(std::move(titleGlyph));
|
||||
|
||||
titleRow->addChild(makeLabel(title, Style::fontSizeHeader * scale, roleColor(ColorRole::Primary), true));
|
||||
titleRow->addChild(makeLabel(title, Style::fontSizeHeader * scale, colorSpecFromRole(ColorRole::Primary), true));
|
||||
|
||||
section->addChild(std::move(titleRow));
|
||||
auto* raw = section.get();
|
||||
@@ -289,10 +288,11 @@ namespace settings {
|
||||
groupHeader->setPadding(Style::spaceSm * scale, 0.0f, 0.0f, 0.0f);
|
||||
groupHeader->addChild(std::make_unique<Separator>());
|
||||
groupHeader->addChild(
|
||||
makeLabel(title, Style::fontSizeBody * scale, roleColor(ColorRole::OnSurfaceVariant), true));
|
||||
makeLabel(title, Style::fontSizeBody * scale, colorSpecFromRole(ColorRole::OnSurfaceVariant), true));
|
||||
section.addChild(std::move(groupHeader));
|
||||
} else {
|
||||
section.addChild(makeLabel(title, Style::fontSizeBody * scale, roleColor(ColorRole::OnSurfaceVariant), true));
|
||||
section.addChild(
|
||||
makeLabel(title, Style::fontSizeBody * scale, colorSpecFromRole(ColorRole::OnSurfaceVariant), true));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -332,9 +332,10 @@ namespace settings {
|
||||
titleRow->setDirection(FlexDirection::Horizontal);
|
||||
titleRow->setAlign(FlexAlign::Center);
|
||||
titleRow->setGap(Style::spaceSm * scale);
|
||||
titleRow->addChild(makeLabel(entry.title, Style::fontSizeBody * scale, roleColor(ColorRole::OnSurface), true));
|
||||
titleRow->addChild(
|
||||
makeLabel(entry.title, Style::fontSizeBody * scale, colorSpecFromRole(ColorRole::OnSurface), true));
|
||||
|
||||
const auto makeBadge = [&](std::string_view label, const ThemeColor& fill, const ThemeColor& color) {
|
||||
const auto makeBadge = [&](std::string_view label, const ColorSpec& fill, const ColorSpec& color) {
|
||||
auto badge = std::make_unique<Flex>();
|
||||
badge->setAlign(FlexAlign::Center);
|
||||
badge->setPadding(1.0f * scale, Style::spaceXs * scale);
|
||||
@@ -345,27 +346,28 @@ namespace settings {
|
||||
};
|
||||
|
||||
if (monitorExplicit) {
|
||||
titleRow->addChild(makeBadge(i18n::tr("settings.badges.monitor"), roleColor(ColorRole::Secondary, 0.15f),
|
||||
roleColor(ColorRole::Secondary)));
|
||||
titleRow->addChild(makeBadge(i18n::tr("settings.badges.monitor"),
|
||||
colorSpecFromRole(ColorRole::Secondary, 0.15f),
|
||||
colorSpecFromRole(ColorRole::Secondary)));
|
||||
} else if (monitorInherited) {
|
||||
titleRow->addChild(makeBadge(i18n::tr("settings.badges.inherited"),
|
||||
roleColor(ColorRole::OnSurfaceVariant, 0.12f),
|
||||
roleColor(ColorRole::OnSurfaceVariant)));
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant, 0.12f),
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant)));
|
||||
}
|
||||
if (overridden) {
|
||||
titleRow->addChild(makeBadge(i18n::tr("settings.badges.override"), roleColor(ColorRole::Primary, 0.15f),
|
||||
roleColor(ColorRole::Primary)));
|
||||
titleRow->addChild(makeBadge(i18n::tr("settings.badges.override"), colorSpecFromRole(ColorRole::Primary, 0.15f),
|
||||
colorSpecFromRole(ColorRole::Primary)));
|
||||
}
|
||||
if (entry.advanced) {
|
||||
titleRow->addChild(makeBadge(i18n::tr("settings.badges.advanced"),
|
||||
roleColor(ColorRole::OnSurfaceVariant, 0.12f),
|
||||
roleColor(ColorRole::OnSurfaceVariant)));
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant, 0.12f),
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant)));
|
||||
}
|
||||
copy->addChild(std::move(titleRow));
|
||||
|
||||
if (!entry.subtitle.empty()) {
|
||||
auto detail =
|
||||
makeLabel(entry.subtitle, Style::fontSizeCaption * scale, roleColor(ColorRole::OnSurfaceVariant), false);
|
||||
auto detail = makeLabel(entry.subtitle, Style::fontSizeCaption * scale,
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant), false);
|
||||
detail->setMaxWidth(360.0f * scale);
|
||||
copy->addChild(std::move(detail));
|
||||
}
|
||||
@@ -564,13 +566,13 @@ namespace settings {
|
||||
auto swatch = std::make_unique<Box>();
|
||||
swatch->setSize(swatchSize, swatchSize);
|
||||
swatch->setRadius(Style::radiusSm * scale);
|
||||
swatch->setBorder(roleColor(ColorRole::Outline), 1.0f);
|
||||
swatch->setBorder(colorSpecFromRole(ColorRole::Outline), 1.0f);
|
||||
Color initialColor;
|
||||
const bool hasColor = !setting.unset && tryParseHexColor(setting.hex, initialColor);
|
||||
if (hasColor) {
|
||||
swatch->setFill(initialColor);
|
||||
} else {
|
||||
swatch->setFill(roleColor(ColorRole::SurfaceVariant));
|
||||
swatch->setFill(colorSpecFromRole(ColorRole::SurfaceVariant));
|
||||
}
|
||||
|
||||
auto button = std::make_unique<Button>();
|
||||
@@ -609,16 +611,16 @@ namespace settings {
|
||||
std::vector<std::string> path) -> std::unique_ptr<Node> {
|
||||
std::vector<SelectOption> opts;
|
||||
opts.reserve(setting.roles.size() + (setting.allowNone ? 1 : 0));
|
||||
std::vector<ThemeColor> indicators;
|
||||
std::vector<ColorSpec> indicators;
|
||||
indicators.reserve(setting.roles.size() + (setting.allowNone ? 1 : 0));
|
||||
|
||||
if (setting.allowNone) {
|
||||
opts.push_back(SelectOption{"", i18n::tr("settings.options.theme-role.default")});
|
||||
indicators.push_back(clearThemeColor());
|
||||
indicators.push_back(clearColorSpec());
|
||||
}
|
||||
for (const auto role : setting.roles) {
|
||||
opts.push_back(SelectOption{std::string(colorRoleToken(role)), std::string(colorRoleToken(role))});
|
||||
indicators.push_back(roleColor(role));
|
||||
indicators.push_back(colorSpecFromRole(role));
|
||||
}
|
||||
|
||||
SelectSetting selectSetting{std::move(opts), setting.selectedValue, setting.allowNone};
|
||||
@@ -644,23 +646,24 @@ namespace settings {
|
||||
titleRow->setDirection(FlexDirection::Horizontal);
|
||||
titleRow->setAlign(FlexAlign::Center);
|
||||
titleRow->setGap(Style::spaceSm * scale);
|
||||
titleRow->addChild(makeLabel(entry.title, Style::fontSizeBody * scale, roleColor(ColorRole::OnSurface), true));
|
||||
titleRow->addChild(
|
||||
makeLabel(entry.title, Style::fontSizeBody * scale, colorSpecFromRole(ColorRole::OnSurface), true));
|
||||
if (overridden) {
|
||||
auto badge = std::make_unique<Flex>();
|
||||
badge->setAlign(FlexAlign::Center);
|
||||
badge->setPadding(1.0f * scale, Style::spaceXs * scale);
|
||||
badge->setRadius(Style::radiusSm * scale);
|
||||
badge->setFill(roleColor(ColorRole::Primary, 0.15f));
|
||||
badge->setFill(colorSpecFromRole(ColorRole::Primary, 0.15f));
|
||||
badge->addChild(makeLabel(i18n::tr("settings.badges.override"), Style::fontSizeCaption * scale,
|
||||
roleColor(ColorRole::Primary), true));
|
||||
colorSpecFromRole(ColorRole::Primary), true));
|
||||
titleRow->addChild(std::move(badge));
|
||||
titleRow->addChild(makeResetButton(entry.path));
|
||||
}
|
||||
block->addChild(std::move(titleRow));
|
||||
|
||||
if (!entry.subtitle.empty()) {
|
||||
block->addChild(
|
||||
makeLabel(entry.subtitle, Style::fontSizeCaption * scale, roleColor(ColorRole::OnSurfaceVariant), false));
|
||||
block->addChild(makeLabel(entry.subtitle, Style::fontSizeCaption * scale,
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant), false));
|
||||
}
|
||||
|
||||
auto checkRow = std::make_unique<Flex>();
|
||||
@@ -712,7 +715,8 @@ namespace settings {
|
||||
setOverride(path, ordered);
|
||||
});
|
||||
item->addChild(std::move(checkbox));
|
||||
item->addChild(makeLabel(option.label, Style::fontSizeBody * scale, roleColor(ColorRole::OnSurface), false));
|
||||
item->addChild(
|
||||
makeLabel(option.label, Style::fontSizeBody * scale, colorSpecFromRole(ColorRole::OnSurface), false));
|
||||
|
||||
checkRow->addChild(std::move(item));
|
||||
}
|
||||
@@ -734,15 +738,16 @@ namespace settings {
|
||||
titleRow->setDirection(FlexDirection::Horizontal);
|
||||
titleRow->setAlign(FlexAlign::Center);
|
||||
titleRow->setGap(Style::spaceSm * scale);
|
||||
titleRow->addChild(makeLabel(entry.title, Style::fontSizeBody * scale, roleColor(ColorRole::OnSurface), true));
|
||||
titleRow->addChild(
|
||||
makeLabel(entry.title, Style::fontSizeBody * scale, colorSpecFromRole(ColorRole::OnSurface), true));
|
||||
if (overridden) {
|
||||
auto badge = std::make_unique<Flex>();
|
||||
badge->setAlign(FlexAlign::Center);
|
||||
badge->setPadding(1.0f * scale, Style::spaceXs * scale);
|
||||
badge->setRadius(Style::radiusSm * scale);
|
||||
badge->setFill(roleColor(ColorRole::Primary, 0.15f));
|
||||
badge->setFill(colorSpecFromRole(ColorRole::Primary, 0.15f));
|
||||
badge->addChild(makeLabel(i18n::tr("settings.badges.override"), Style::fontSizeCaption * scale,
|
||||
roleColor(ColorRole::Primary), true));
|
||||
colorSpecFromRole(ColorRole::Primary), true));
|
||||
titleRow->addChild(std::move(badge));
|
||||
}
|
||||
if (overridden) {
|
||||
@@ -751,8 +756,8 @@ namespace settings {
|
||||
block->addChild(std::move(titleRow));
|
||||
|
||||
if (!entry.subtitle.empty()) {
|
||||
block->addChild(
|
||||
makeLabel(entry.subtitle, Style::fontSizeCaption * scale, roleColor(ColorRole::OnSurfaceVariant), false));
|
||||
block->addChild(makeLabel(entry.subtitle, Style::fontSizeCaption * scale,
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant), false));
|
||||
}
|
||||
|
||||
const auto resolveItemLabel = [&list](const std::string& value) -> std::string {
|
||||
@@ -777,7 +782,7 @@ namespace settings {
|
||||
labelCell->setAlign(FlexAlign::Center);
|
||||
labelCell->setMinWidth(labelCellWidth);
|
||||
labelCell->addChild(makeLabel(resolveItemLabel(list.items[i]), Style::fontSizeCaption * scale,
|
||||
roleColor(ColorRole::OnSurface), false));
|
||||
colorSpecFromRole(ColorRole::OnSurface), false));
|
||||
itemRow->addChild(std::move(labelCell));
|
||||
|
||||
auto removeBtn = std::make_unique<Button>();
|
||||
@@ -1077,13 +1082,13 @@ namespace settings {
|
||||
emptyState->setJustify(FlexJustify::Center);
|
||||
emptyState->setGap(Style::spaceXs * scale);
|
||||
emptyState->setPadding((Style::spaceLg + Style::spaceMd) * scale);
|
||||
emptyState->setFill(roleColor(ColorRole::SurfaceVariant, 0.24f));
|
||||
emptyState->setBorder(roleColor(ColorRole::Outline, 0.28f), Style::borderWidth);
|
||||
emptyState->setFill(colorSpecFromRole(ColorRole::SurfaceVariant, 0.24f));
|
||||
emptyState->setBorder(colorSpecFromRole(ColorRole::Outline, 0.28f), Style::borderWidth);
|
||||
emptyState->setRadius(Style::radiusMd * scale);
|
||||
emptyState->addChild(makeLabel(i18n::tr("settings.window.no-results"), Style::fontSizeBody * scale,
|
||||
roleColor(ColorRole::OnSurface), true));
|
||||
colorSpecFromRole(ColorRole::OnSurface), true));
|
||||
emptyState->addChild(makeLabel(i18n::tr("settings.window.no-results-hint"), Style::fontSizeCaption * scale,
|
||||
roleColor(ColorRole::OnSurfaceVariant), false));
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant), false));
|
||||
|
||||
auto emptyRow = std::make_unique<Flex>();
|
||||
emptyRow->setDirection(FlexDirection::Horizontal);
|
||||
|
||||
@@ -20,8 +20,7 @@
|
||||
namespace settings {
|
||||
namespace {
|
||||
|
||||
std::unique_ptr<Label> makeLabel(std::string_view text, float fontSize, const ThemeColor& color,
|
||||
bool bold = false) {
|
||||
std::unique_ptr<Label> makeLabel(std::string_view text, float fontSize, const ColorSpec& color, bool bold = false) {
|
||||
auto label = std::make_unique<Label>();
|
||||
label->setText(text);
|
||||
label->setFontSize(fontSize);
|
||||
@@ -53,8 +52,8 @@ namespace settings {
|
||||
section->setGap(Style::spaceSm * scale);
|
||||
section->setPadding(Style::spaceSm * scale, Style::spaceMd * scale);
|
||||
section->setCardStyle(scale);
|
||||
section->setFill(roleColor(ColorRole::Surface));
|
||||
section->addChild(makeLabel(title, Style::fontSizeTitle * scale, roleColor(ColorRole::OnSurface), true));
|
||||
section->setFill(colorSpecFromRole(ColorRole::Surface));
|
||||
section->addChild(makeLabel(title, Style::fontSizeTitle * scale, colorSpecFromRole(ColorRole::OnSurface), true));
|
||||
|
||||
auto* raw = section.get();
|
||||
content.addChild(std::move(section));
|
||||
@@ -157,15 +156,15 @@ namespace settings {
|
||||
confirmPanel->setGap(Style::spaceXs * ctx.scale);
|
||||
confirmPanel->setPadding(Style::spaceSm * ctx.scale);
|
||||
confirmPanel->setRadius(Style::radiusSm * ctx.scale);
|
||||
confirmPanel->setFill(roleColor(ColorRole::Error, 0.10f));
|
||||
confirmPanel->setBorder(roleColor(ColorRole::Error, 0.35f), Style::borderWidth);
|
||||
confirmPanel->setFill(colorSpecFromRole(ColorRole::Error, 0.10f));
|
||||
confirmPanel->setBorder(colorSpecFromRole(ColorRole::Error, 0.35f), Style::borderWidth);
|
||||
|
||||
confirmPanel->addChild(
|
||||
makeLabel(i18n::tr("settings.entities.monitor-override.delete-confirm-title", "name", match),
|
||||
Style::fontSizeBody * ctx.scale, roleColor(ColorRole::Error), true));
|
||||
Style::fontSizeBody * ctx.scale, colorSpecFromRole(ColorRole::Error), true));
|
||||
confirmPanel->addChild(makeLabel(i18n::tr("settings.entities.monitor-override.delete-confirm-desc"),
|
||||
Style::fontSizeCaption * ctx.scale, roleColor(ColorRole::OnSurfaceVariant),
|
||||
false));
|
||||
Style::fontSizeCaption * ctx.scale,
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant), false));
|
||||
|
||||
auto confirmRow = std::make_unique<Flex>();
|
||||
confirmRow->setDirection(FlexDirection::Horizontal);
|
||||
@@ -349,14 +348,14 @@ namespace settings {
|
||||
confirmPanel->setGap(Style::spaceXs * ctx.scale);
|
||||
confirmPanel->setPadding(Style::spaceSm * ctx.scale);
|
||||
confirmPanel->setRadius(Style::radiusSm * ctx.scale);
|
||||
confirmPanel->setFill(roleColor(ColorRole::Error, 0.10f));
|
||||
confirmPanel->setBorder(roleColor(ColorRole::Error, 0.35f), Style::borderWidth);
|
||||
confirmPanel->setFill(colorSpecFromRole(ColorRole::Error, 0.10f));
|
||||
confirmPanel->setBorder(colorSpecFromRole(ColorRole::Error, 0.35f), Style::borderWidth);
|
||||
|
||||
confirmPanel->addChild(makeLabel(i18n::tr("settings.entities.bar.delete-confirm-title", "name", barName),
|
||||
Style::fontSizeBody * ctx.scale, roleColor(ColorRole::Error), true));
|
||||
Style::fontSizeBody * ctx.scale, colorSpecFromRole(ColorRole::Error), true));
|
||||
confirmPanel->addChild(makeLabel(i18n::tr("settings.entities.bar.delete-confirm-desc"),
|
||||
Style::fontSizeCaption * ctx.scale, roleColor(ColorRole::OnSurfaceVariant),
|
||||
false));
|
||||
Style::fontSizeCaption * ctx.scale,
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant), false));
|
||||
|
||||
auto confirmRow = std::make_unique<Flex>();
|
||||
confirmRow->setDirection(FlexDirection::Horizontal);
|
||||
|
||||
@@ -79,14 +79,14 @@ namespace settings {
|
||||
return SelectSetting{std::move(opts), std::string(selected)};
|
||||
}
|
||||
|
||||
std::string colorRoleValue(const ThemeColor& color) {
|
||||
std::string colorRoleValue(const ColorSpec& color) {
|
||||
if (color.role.has_value()) {
|
||||
return std::string(colorRoleToken(*color.role));
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string optionalColorRoleValue(const std::optional<ThemeColor>& color) {
|
||||
std::string optionalColorRoleValue(const std::optional<ColorSpec>& color) {
|
||||
if (color.has_value()) {
|
||||
return colorRoleValue(*color);
|
||||
}
|
||||
@@ -102,15 +102,15 @@ namespace settings {
|
||||
return roles;
|
||||
}
|
||||
|
||||
ColorRolePickerSetting colorRolePicker(const ThemeColor& selected) {
|
||||
ColorRolePickerSetting colorRolePicker(const ColorSpec& selected) {
|
||||
return ColorRolePickerSetting{allColorRoles(), colorRoleValue(selected)};
|
||||
}
|
||||
|
||||
ColorRolePickerSetting optionalColorRolePicker(const std::optional<ThemeColor>& selected) {
|
||||
ColorRolePickerSetting optionalColorRolePicker(const std::optional<ColorSpec>& selected) {
|
||||
return ColorRolePickerSetting{allColorRoles(), optionalColorRoleValue(selected), true};
|
||||
}
|
||||
|
||||
ColorRolePickerSetting capsuleBorderRolePicker(const std::optional<ThemeColor>& selected) {
|
||||
ColorRolePickerSetting capsuleBorderRolePicker(const std::optional<ColorSpec>& selected) {
|
||||
return ColorRolePickerSetting{allColorRoles(), optionalColorRoleValue(selected), true};
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ namespace settings {
|
||||
ColorSetting fillColor;
|
||||
fillColor.unset = !cfg.wallpaper.fillColor.has_value();
|
||||
if (!fillColor.unset) {
|
||||
fillColor.hex = formatRgbHex(resolveThemeColor(*cfg.wallpaper.fillColor));
|
||||
fillColor.hex = formatRgbHex(resolveColorSpec(*cfg.wallpaper.fillColor));
|
||||
}
|
||||
entries.push_back(makeEntry("wallpaper", "general", tr("settings.schema.wallpaper.fill-color.label"),
|
||||
tr("settings.schema.wallpaper.fill-color.description"), {"wallpaper", "fill_color"},
|
||||
@@ -718,17 +718,17 @@ namespace settings {
|
||||
ToggleSetting{selectedBar->widgetCapsuleDefault}, "pill"));
|
||||
entries.push_back(makeEntry(section, "widgets", tr("settings.schema.bar.widget-color.label"),
|
||||
tr("settings.schema.bar.widget-color.description"), path("color"),
|
||||
optionalColorRolePicker(selectedBar->widgetColor), "theme role foreground", true));
|
||||
optionalColorRolePicker(selectedBar->widgetColor), "color role foreground", true));
|
||||
entries.push_back(makeEntry(section, "widgets", tr("settings.schema.bar.capsule-fill.label"),
|
||||
tr("settings.schema.bar.capsule-fill.description"), path("capsule_fill"),
|
||||
colorRolePicker(selectedBar->widgetCapsuleFill), "theme role pill", true));
|
||||
colorRolePicker(selectedBar->widgetCapsuleFill), "color role pill", true));
|
||||
entries.push_back(makeEntry(section, "widgets", tr("settings.schema.bar.capsule-foreground.label"),
|
||||
tr("settings.schema.bar.capsule-foreground.description"), path("capsule_foreground"),
|
||||
optionalColorRolePicker(selectedBar->widgetCapsuleForeground),
|
||||
"theme role foreground pill", true));
|
||||
"color role foreground pill", true));
|
||||
entries.push_back(makeEntry(section, "widgets", tr("settings.schema.bar.capsule-border.label"),
|
||||
tr("settings.schema.bar.capsule-border.description"), path("capsule_border"),
|
||||
capsuleBorderRolePicker(selectedBar->widgetCapsuleBorder), "theme role pill outline",
|
||||
capsuleBorderRolePicker(selectedBar->widgetCapsuleBorder), "color role pill outline",
|
||||
true));
|
||||
entries.push_back(
|
||||
makeEntry(section, "widgets", tr("settings.schema.bar.widget-spacing.label"),
|
||||
@@ -842,22 +842,22 @@ namespace settings {
|
||||
makeEntry(section, "widgets", tr("settings.schema.bar.widget-color.label"),
|
||||
tr("settings.schema.bar.widget-color.description"), mpath("color"),
|
||||
optionalColorRolePicker(ovr.widgetColor.has_value() ? ovr.widgetColor : bar.widgetColor),
|
||||
"theme role foreground", true));
|
||||
"color role foreground", true));
|
||||
entries.push_back(makeEntry(section, "widgets", tr("settings.schema.bar.capsule-fill.label"),
|
||||
tr("settings.schema.bar.capsule-fill.description"), mpath("capsule_fill"),
|
||||
colorRolePicker(ovr.widgetCapsuleFill.value_or(bar.widgetCapsuleFill)),
|
||||
"theme role pill", true));
|
||||
"color role pill", true));
|
||||
entries.push_back(
|
||||
makeEntry(section, "widgets", tr("settings.schema.bar.capsule-foreground.label"),
|
||||
tr("settings.schema.bar.capsule-foreground.description"), mpath("capsule_foreground"),
|
||||
optionalColorRolePicker(ovr.widgetCapsuleForeground.has_value() ? ovr.widgetCapsuleForeground
|
||||
: bar.widgetCapsuleForeground),
|
||||
"theme role foreground pill", true));
|
||||
"color role foreground pill", true));
|
||||
entries.push_back(makeEntry(
|
||||
section, "widgets", tr("settings.schema.bar.capsule-border.label"),
|
||||
tr("settings.schema.bar.capsule-border.description"), mpath("capsule_border"),
|
||||
capsuleBorderRolePicker(ovr.widgetCapsuleBorderSpecified ? ovr.widgetCapsuleBorder : bar.widgetCapsuleBorder),
|
||||
"theme role pill outline", true));
|
||||
"color role pill outline", true));
|
||||
entries.push_back(
|
||||
makeEntry(section, "widgets", tr("settings.schema.bar.capsule-padding.label"),
|
||||
tr("settings.schema.bar.capsule-padding.description"), mpath("capsule_padding"),
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace settings {
|
||||
sidebarScroll->setScrollbarVisible(true);
|
||||
sidebarScroll->setViewportPaddingH(0.0f);
|
||||
sidebarScroll->setViewportPaddingV(0.0f);
|
||||
sidebarScroll->setFill(roleColor(ColorRole::Surface));
|
||||
sidebarScroll->setFill(colorSpecFromRole(ColorRole::Surface));
|
||||
sidebarScroll->setRadius(Style::radiusXl * scale);
|
||||
sidebarScroll->clearBorder();
|
||||
sidebarScroll->setFillHeight(true);
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace {
|
||||
constexpr std::int32_t kActionSupportReport = 1;
|
||||
constexpr std::int32_t kActionFlattenedConfig = 2;
|
||||
|
||||
std::unique_ptr<Label> makeLabel(std::string_view text, float fontSize, const ThemeColor& color, bool bold = false) {
|
||||
std::unique_ptr<Label> makeLabel(std::string_view text, float fontSize, const ColorSpec& color, bool bold = false) {
|
||||
auto label = std::make_unique<Label>();
|
||||
label->setText(text);
|
||||
label->setFontSize(fontSize);
|
||||
@@ -1041,7 +1041,7 @@ void SettingsWindow::buildScene(std::uint32_t width, std::uint32_t height) {
|
||||
headerTitle->setText(i18n::tr("settings.window.title"));
|
||||
headerTitle->setBold(true);
|
||||
headerTitle->setFontSize(Style::fontSizeTitle * scale);
|
||||
headerTitle->setColor(roleColor(ColorRole::OnSurface));
|
||||
headerTitle->setColor(colorSpecFromRole(ColorRole::OnSurface));
|
||||
headerTitle->setFlexGrow(1.0f);
|
||||
headerTitle->setStableBaseline(true);
|
||||
header->addChild(std::move(headerTitle));
|
||||
@@ -1111,7 +1111,7 @@ void SettingsWindow::buildScene(std::uint32_t width, std::uint32_t height) {
|
||||
filters->addChild(std::make_unique<Spacer>());
|
||||
|
||||
auto advancedLabel = makeLabel(i18n::tr("settings.badges.advanced"), Style::fontSizeBody * scale,
|
||||
roleColor(ColorRole::OnSurfaceVariant), false);
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant), false);
|
||||
filters->addChild(std::move(advancedLabel));
|
||||
|
||||
auto advancedToggle = std::make_unique<Toggle>();
|
||||
@@ -1136,7 +1136,7 @@ void SettingsWindow::buildScene(std::uint32_t width, std::uint32_t height) {
|
||||
filters->addChild(std::move(advancedToggle));
|
||||
|
||||
auto overriddenLabel = makeLabel(i18n::tr("settings.window.filter-modified"), Style::fontSizeBody * scale,
|
||||
roleColor(ColorRole::OnSurfaceVariant), false);
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant), false);
|
||||
filters->addChild(std::move(overriddenLabel));
|
||||
|
||||
auto overriddenToggle = std::make_unique<Toggle>();
|
||||
@@ -1185,11 +1185,12 @@ void SettingsWindow::buildScene(std::uint32_t width, std::uint32_t height) {
|
||||
status->setGap(Style::spaceSm * scale);
|
||||
status->setPadding(Style::spaceXs * scale, Style::spaceSm * scale);
|
||||
status->setRadius(Style::radiusMd * scale);
|
||||
status->setFill(roleColor(m_statusIsError ? ColorRole::Error : ColorRole::Secondary, 0.14f));
|
||||
status->setBorder(roleColor(m_statusIsError ? ColorRole::Error : ColorRole::Secondary, 0.45f), Style::borderWidth);
|
||||
status->setFill(colorSpecFromRole(m_statusIsError ? ColorRole::Error : ColorRole::Secondary, 0.14f));
|
||||
status->setBorder(colorSpecFromRole(m_statusIsError ? ColorRole::Error : ColorRole::Secondary, 0.45f),
|
||||
Style::borderWidth);
|
||||
|
||||
auto message = makeLabel(m_statusMessage, Style::fontSizeCaption * scale,
|
||||
roleColor(m_statusIsError ? ColorRole::Error : ColorRole::Secondary), true);
|
||||
colorSpecFromRole(m_statusIsError ? ColorRole::Error : ColorRole::Secondary), true);
|
||||
message->setFlexGrow(1.0f);
|
||||
status->addChild(std::move(message));
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace {
|
||||
constexpr std::string_view kDefaultThemeSource = "builtin";
|
||||
constexpr std::string_view kDefaultBuiltinPalette = "Noctalia";
|
||||
|
||||
std::unique_ptr<Label> makeLabel(std::string_view text, float fontSize, const ThemeColor& color, bool bold = false) {
|
||||
std::unique_ptr<Label> makeLabel(std::string_view text, float fontSize, const ColorSpec& color, bool bold = false) {
|
||||
auto label = std::make_unique<Label>();
|
||||
label->setText(text);
|
||||
label->setFontSize(fontSize);
|
||||
@@ -162,9 +162,10 @@ void SetupWizardPanel::create() {
|
||||
|
||||
auto copy = makeTextColumn();
|
||||
copy->setGap(Style::spaceXs * scale);
|
||||
copy->addChild(makeLabel(i18n::tr("setup-wizard.title"), 18.0f * scale, roleColor(ColorRole::OnSurface), true));
|
||||
copy->addChild(
|
||||
makeLabel(i18n::tr("setup-wizard.title"), 18.0f * scale, colorSpecFromRole(ColorRole::OnSurface), true));
|
||||
copy->addChild(makeLabel(i18n::tr("setup-wizard.subtitle"), Style::fontSizeBody * scale,
|
||||
roleColor(ColorRole::OnSurfaceVariant)));
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant)));
|
||||
header->addChild(std::move(copy));
|
||||
root->addChild(std::move(header));
|
||||
}
|
||||
@@ -179,9 +180,9 @@ void SetupWizardPanel::create() {
|
||||
{
|
||||
auto col = makeTextColumn();
|
||||
col->addChild(makeLabel(i18n::tr("settings.schema.shell.telemetry.label"), Style::fontSizeBody * scale,
|
||||
roleColor(ColorRole::OnSurface), true));
|
||||
colorSpecFromRole(ColorRole::OnSurface), true));
|
||||
auto description = makeLabel(i18n::tr("settings.schema.shell.telemetry.description"),
|
||||
Style::fontSizeCaption * scale, roleColor(ColorRole::OnSurfaceVariant));
|
||||
Style::fontSizeCaption * scale, colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
description->setMaxWidth(360.0f * scale);
|
||||
col->addChild(std::move(description));
|
||||
row->addChild(std::move(col));
|
||||
@@ -205,10 +206,10 @@ void SetupWizardPanel::create() {
|
||||
{
|
||||
auto col = makeTextColumn();
|
||||
col->addChild(makeLabel(i18n::tr("setup-wizard.wallpaper"), Style::fontSizeBody * scale,
|
||||
roleColor(ColorRole::OnSurface), true));
|
||||
colorSpecFromRole(ColorRole::OnSurface), true));
|
||||
const std::string currentPath = m_config->getDefaultWallpaperPath();
|
||||
auto pathLabel = makeLabel(currentPath.empty() ? i18n::tr("setup-wizard.no-wallpaper-selected") : currentPath,
|
||||
Style::fontSizeCaption * scale, roleColor(ColorRole::OnSurfaceVariant));
|
||||
Style::fontSizeCaption * scale, colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
pathLabel->setMaxWidth(330.0f * scale);
|
||||
pathLabel->setMaxLines(1);
|
||||
m_wallpaperLabel = pathLabel.get();
|
||||
@@ -248,7 +249,7 @@ void SetupWizardPanel::create() {
|
||||
m_wallpaperDir = parentDir;
|
||||
if (m_wallpaperLabel != nullptr) {
|
||||
m_wallpaperLabel->setText(fullPath);
|
||||
m_wallpaperLabel->setColor(roleColor(ColorRole::Primary));
|
||||
m_wallpaperLabel->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
m_wallpaperLabel->setMaxLines(1);
|
||||
}
|
||||
m_config->setOverride({"wallpaper", "directory"}, parentDir);
|
||||
@@ -268,8 +269,8 @@ void SetupWizardPanel::create() {
|
||||
// Mode row
|
||||
{
|
||||
auto row = makeRow(scale);
|
||||
auto label =
|
||||
makeLabel(i18n::tr("setup-wizard.mode"), Style::fontSizeBody * scale, roleColor(ColorRole::OnSurface));
|
||||
auto label = makeLabel(i18n::tr("setup-wizard.mode"), Style::fontSizeBody * scale,
|
||||
colorSpecFromRole(ColorRole::OnSurface));
|
||||
label->setFlexGrow(1.0f);
|
||||
row->addChild(std::move(label));
|
||||
|
||||
@@ -302,7 +303,7 @@ void SetupWizardPanel::create() {
|
||||
{
|
||||
auto row = makeRow(scale);
|
||||
auto label = makeLabel(i18n::tr("settings.schema.appearance.theme-source.label"), Style::fontSizeBody * scale,
|
||||
roleColor(ColorRole::OnSurface));
|
||||
colorSpecFromRole(ColorRole::OnSurface));
|
||||
label->setFlexGrow(1.0f);
|
||||
row->addChild(std::move(label));
|
||||
|
||||
@@ -334,7 +335,7 @@ void SetupWizardPanel::create() {
|
||||
// Theme option row
|
||||
{
|
||||
auto row = makeRow(scale);
|
||||
auto label = makeLabel("", Style::fontSizeBody * scale, roleColor(ColorRole::OnSurface));
|
||||
auto label = makeLabel("", Style::fontSizeBody * scale, colorSpecFromRole(ColorRole::OnSurface));
|
||||
label->setFlexGrow(1.0f);
|
||||
m_themeOptionLabel = label.get();
|
||||
row->addChild(std::move(label));
|
||||
@@ -366,7 +367,7 @@ void SetupWizardPanel::create() {
|
||||
footer->setJustify(FlexJustify::SpaceBetween);
|
||||
|
||||
footer->addChild(makeLabel(i18n::tr("setup-wizard.footer-note"), Style::fontSizeCaption * scale,
|
||||
roleColor(ColorRole::OnSurfaceVariant)));
|
||||
colorSpecFromRole(ColorRole::OnSurfaceVariant)));
|
||||
|
||||
auto button = std::make_unique<Button>();
|
||||
button->setText(i18n::tr("setup-wizard.get-started"));
|
||||
|
||||
@@ -37,7 +37,7 @@ void TestPanel::create() {
|
||||
auto header = std::make_unique<Label>();
|
||||
header->setText("Test Controls");
|
||||
header->setFontSize(Style::fontSizeTitle * scale);
|
||||
header->setColor(roleColor(ColorRole::Primary));
|
||||
header->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
m_headerLabel = header.get();
|
||||
rootLayout->addChild(std::move(header));
|
||||
|
||||
@@ -92,7 +92,7 @@ void TestPanel::create() {
|
||||
auto label = std::make_unique<Label>();
|
||||
label->setText(title);
|
||||
label->setFontSize(Style::fontSizeCaption * scale);
|
||||
label->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
label->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
section->addChild(std::move(label));
|
||||
return section;
|
||||
};
|
||||
@@ -403,7 +403,7 @@ void TestPanel::create() {
|
||||
resultLabel->setText("No image selected");
|
||||
resultLabel->setCaptionStyle();
|
||||
resultLabel->setFontSize(Style::fontSizeCaption * scale);
|
||||
resultLabel->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
resultLabel->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
resultLabel->setMaxWidth(280.0f * scale);
|
||||
m_fileDialogResultLabel = resultLabel.get();
|
||||
|
||||
@@ -427,10 +427,10 @@ void TestPanel::create() {
|
||||
}
|
||||
if (result.has_value()) {
|
||||
m_fileDialogResultLabel->setText(result->string());
|
||||
m_fileDialogResultLabel->setColor(roleColor(ColorRole::Primary));
|
||||
m_fileDialogResultLabel->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
} else {
|
||||
m_fileDialogResultLabel->setText("Cancelled");
|
||||
m_fileDialogResultLabel->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
m_fileDialogResultLabel->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -448,11 +448,11 @@ void TestPanel::create() {
|
||||
auto resultSwatch = std::make_unique<Box>();
|
||||
resultSwatch->setSize(28.0f * scale, 28.0f * scale);
|
||||
resultSwatch->setRadius(Style::radiusMd * scale);
|
||||
resultSwatch->setBorder(roleColor(ColorRole::Outline), Style::borderWidth * scale);
|
||||
resultSwatch->setBorder(colorSpecFromRole(ColorRole::Outline), Style::borderWidth * scale);
|
||||
if (const auto last = ColorPickerDialog::lastResult()) {
|
||||
resultSwatch->setFill(*last);
|
||||
} else {
|
||||
resultSwatch->setFill(resolveThemeColor(roleColor(ColorRole::Primary)));
|
||||
resultSwatch->setFill(colorForRole(ColorRole::Primary));
|
||||
}
|
||||
m_colorPickerResultSwatch = resultSwatch.get();
|
||||
|
||||
@@ -514,8 +514,8 @@ void TestPanel::create() {
|
||||
tile->setPadding(Style::spaceSm * scale, Style::spaceSm * scale);
|
||||
if (tileData.accent) {
|
||||
tile->setRadius(Style::radiusMd * scale);
|
||||
tile->setFill(roleColor(ColorRole::Primary));
|
||||
tile->setBorder(roleColor(ColorRole::Primary), Style::borderWidth);
|
||||
tile->setFill(colorSpecFromRole(ColorRole::Primary));
|
||||
tile->setBorder(colorSpecFromRole(ColorRole::Primary), Style::borderWidth);
|
||||
} else {
|
||||
tile->setCardStyle(scale);
|
||||
tile->setRadius(Style::radiusMd * scale);
|
||||
@@ -524,14 +524,14 @@ void TestPanel::create() {
|
||||
auto icon = std::make_unique<Glyph>();
|
||||
icon->setGlyph(tileData.glyph);
|
||||
icon->setGlyphSize(16.0f * scale);
|
||||
icon->setColor(roleColor(tileData.accent ? ColorRole::OnPrimary : ColorRole::OnSurface));
|
||||
icon->setColor(colorSpecFromRole(tileData.accent ? ColorRole::OnPrimary : ColorRole::OnSurface));
|
||||
tile->addChild(std::move(icon));
|
||||
|
||||
auto label = std::make_unique<Label>();
|
||||
label->setText(tileData.label);
|
||||
label->setCaptionStyle();
|
||||
label->setFontSize(Style::fontSizeCaption * scale);
|
||||
label->setColor(roleColor(tileData.accent ? ColorRole::OnPrimary : ColorRole::OnSurfaceVariant));
|
||||
label->setColor(colorSpecFromRole(tileData.accent ? ColorRole::OnPrimary : ColorRole::OnSurfaceVariant));
|
||||
tile->addChild(std::move(label));
|
||||
|
||||
grid->addChild(std::move(tile));
|
||||
@@ -546,15 +546,15 @@ void TestPanel::create() {
|
||||
{
|
||||
auto transformStage = std::make_unique<Box>();
|
||||
transformStage->setSize(280.0f * scale, 220.0f * scale);
|
||||
transformStage->setFill(roleColor(ColorRole::Surface));
|
||||
transformStage->setBorder(roleColor(ColorRole::Outline), Style::borderWidth * scale);
|
||||
transformStage->setFill(colorSpecFromRole(ColorRole::Surface));
|
||||
transformStage->setBorder(colorSpecFromRole(ColorRole::Outline), Style::borderWidth * scale);
|
||||
transformStage->setRadius(Style::radiusLg * scale);
|
||||
m_transformStage = transformStage.get();
|
||||
|
||||
auto demoBox = std::make_unique<Box>();
|
||||
demoBox->setSize(180.0f * scale, 100.0f * scale);
|
||||
demoBox->setFill(roleColor(ColorRole::SurfaceVariant));
|
||||
demoBox->setBorder(roleColor(ColorRole::Primary), Style::borderWidth * scale);
|
||||
demoBox->setFill(colorSpecFromRole(ColorRole::SurfaceVariant));
|
||||
demoBox->setBorder(colorSpecFromRole(ColorRole::Primary), Style::borderWidth * scale);
|
||||
demoBox->setRadius(Style::radiusLg * scale);
|
||||
demoBox->setRotation(0.0f);
|
||||
m_transformDemoBox = demoBox.get();
|
||||
@@ -570,7 +570,7 @@ void TestPanel::create() {
|
||||
demoButton->setOnClick([this]() {
|
||||
if (m_transformHelp != nullptr) {
|
||||
m_transformHelp->setText("Transform button clicked!");
|
||||
m_transformHelp->setColor(roleColor(ColorRole::Secondary));
|
||||
m_transformHelp->setColor(colorSpecFromRole(ColorRole::Secondary));
|
||||
}
|
||||
});
|
||||
m_transformDemoButton = demoButton.get();
|
||||
@@ -580,22 +580,22 @@ void TestPanel::create() {
|
||||
demoGlyph->setGlyph("noctalia");
|
||||
demoGlyph->setPosition(150.0f * scale, 60.0f * scale);
|
||||
demoGlyph->setGlyphSize(24.0f * scale);
|
||||
demoGlyph->setColor(roleColor(ColorRole::Primary));
|
||||
demoGlyph->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
demoGlyph->setRotation(static_cast<float>(M_PI) * 0.5f);
|
||||
m_transformDemoGlyph = demoGlyph.get();
|
||||
m_transformDemoBox->addChild(std::move(demoGlyph));
|
||||
|
||||
auto badgeBox = std::make_unique<Box>();
|
||||
badgeBox->setSize(28.0f * scale, 28.0f * scale);
|
||||
badgeBox->setFill(roleColor(ColorRole::Primary));
|
||||
badgeBox->setBorder(roleColor(ColorRole::Outline), Style::borderWidth * scale);
|
||||
badgeBox->setFill(colorSpecFromRole(ColorRole::Primary));
|
||||
badgeBox->setBorder(colorSpecFromRole(ColorRole::Outline), Style::borderWidth * scale);
|
||||
badgeBox->setRadius(14.0f * scale);
|
||||
m_transformBadgeBox = badgeBox.get();
|
||||
|
||||
auto badgeLabel = std::make_unique<Label>();
|
||||
badgeLabel->setText("3");
|
||||
badgeLabel->setFontSize(Style::fontSizeCaption * scale);
|
||||
badgeLabel->setColor(roleColor(ColorRole::OnPrimary));
|
||||
badgeLabel->setColor(colorSpecFromRole(ColorRole::OnPrimary));
|
||||
m_transformBadgeLabel = badgeLabel.get();
|
||||
m_transformBadgeBox->addChild(std::move(badgeLabel));
|
||||
m_transformDemoBox->addChild(std::move(badgeBox));
|
||||
@@ -604,7 +604,7 @@ void TestPanel::create() {
|
||||
auto helpLabel = std::make_unique<Label>();
|
||||
helpLabel->setText("Rotated node with children.");
|
||||
helpLabel->setFontSize(Style::fontSizeCaption * scale);
|
||||
helpLabel->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
helpLabel->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_transformHelp = helpLabel.get();
|
||||
|
||||
auto section = makeSection("Transforms");
|
||||
|
||||
@@ -66,7 +66,7 @@ void WallpaperPanel::create() {
|
||||
root->setAlign(FlexAlign::Stretch);
|
||||
root->setGap(Style::spaceSm * scale);
|
||||
root->setPadding(Style::spaceMd * scale);
|
||||
root->setFill(roleColor(ColorRole::Surface));
|
||||
root->setFill(colorSpecFromRole(ColorRole::Surface));
|
||||
root->setRadius(Style::radiusXl * scale);
|
||||
m_rootLayout = root.get();
|
||||
|
||||
@@ -88,14 +88,14 @@ void WallpaperPanel::create() {
|
||||
title->setText(i18n::tr("wallpaper.panel.title"));
|
||||
title->setFontSize(Style::fontSizeTitle * scale);
|
||||
title->setBold(true);
|
||||
title->setColor(roleColor(ColorRole::Primary));
|
||||
title->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
m_title = title.get();
|
||||
headerLeft->addChild(std::move(title));
|
||||
header->addChild(std::move(headerLeft));
|
||||
|
||||
auto breadcrumb = std::make_unique<Label>();
|
||||
breadcrumb->setFontSize(Style::fontSizeBody * scale);
|
||||
breadcrumb->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
breadcrumb->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
breadcrumb->setMaxLines(1);
|
||||
m_breadcrumb = breadcrumb.get();
|
||||
header->addChild(std::move(breadcrumb));
|
||||
@@ -166,7 +166,7 @@ void WallpaperPanel::create() {
|
||||
auto flattenLabel = std::make_unique<Label>();
|
||||
flattenLabel->setText(i18n::tr("wallpaper.panel.flatten"));
|
||||
flattenLabel->setFontSize(Style::fontSizeBody * scale);
|
||||
flattenLabel->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
flattenLabel->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_flattenLabel = static_cast<Label*>(toolbar->addChild(std::move(flattenLabel)));
|
||||
|
||||
auto flatten = std::make_unique<Toggle>();
|
||||
@@ -335,7 +335,7 @@ void WallpaperPanel::create() {
|
||||
|
||||
auto pageLabel = std::make_unique<Label>();
|
||||
pageLabel->setFontSize(Style::fontSizeBody * scale);
|
||||
pageLabel->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
pageLabel->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
m_pageLabel = static_cast<Label*>(pagination->addChild(std::move(pageLabel)));
|
||||
|
||||
auto next = std::make_unique<Button>();
|
||||
@@ -553,13 +553,13 @@ std::optional<Color> WallpaperPanel::selectedFillColor() const {
|
||||
if (!choice.connector.empty()) {
|
||||
for (const auto& ovr : wp.monitorOverrides) {
|
||||
if (ovr.match == choice.connector && ovr.fillColor.has_value()) {
|
||||
return resolveThemeColor(*ovr.fillColor);
|
||||
return resolveColorSpec(*ovr.fillColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wp.fillColor.has_value()) {
|
||||
return resolveThemeColor(*wp.fillColor);
|
||||
return resolveColorSpec(*wp.fillColor);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -69,27 +69,27 @@ WallpaperTile::WallpaperTile(float cellWidth, float cellHeight, float contentSca
|
||||
auto image = std::make_unique<Image>();
|
||||
image->setFit(ImageFit::Cover);
|
||||
image->setRadius(frameRadius);
|
||||
image->setBorder(roleColor(ColorRole::Outline), outlineWidth);
|
||||
image->setBorder(colorSpecFromRole(ColorRole::Outline), outlineWidth);
|
||||
image->setFrameSize(frameWidth, frameHeight);
|
||||
m_thumb = static_cast<Image*>(m_thumbBox->addChild(std::move(image)));
|
||||
|
||||
auto glyph = std::make_unique<Glyph>();
|
||||
glyph->setGlyph("folder");
|
||||
glyph->setGlyphSize(std::min(frameWidth, frameHeight) * 0.45f);
|
||||
glyph->setColor(roleColor(ColorRole::Primary));
|
||||
glyph->setColor(colorSpecFromRole(ColorRole::Primary));
|
||||
glyph->setVisible(false);
|
||||
m_folderGlyph = static_cast<Glyph*>(m_thumbBox->addChild(std::move(glyph)));
|
||||
|
||||
auto loadingGlyph = std::make_unique<Glyph>();
|
||||
loadingGlyph->setGlyph("hourglass");
|
||||
loadingGlyph->setGlyphSize(std::min(frameWidth, frameHeight) * 0.32f);
|
||||
loadingGlyph->setColor(roleColor(ColorRole::OnSurface, 0.5f));
|
||||
loadingGlyph->setColor(colorSpecFromRole(ColorRole::OnSurface, 0.5f));
|
||||
loadingGlyph->setVisible(false);
|
||||
m_loadingGlyph = static_cast<Glyph*>(m_thumbBox->addChild(std::move(loadingGlyph)));
|
||||
|
||||
auto label = std::make_unique<Label>();
|
||||
label->setFontSize(Style::fontSizeCaption * m_contentScale);
|
||||
label->setColor(roleColor(ColorRole::OnSurfaceVariant));
|
||||
label->setColor(colorSpecFromRole(ColorRole::OnSurfaceVariant));
|
||||
label->setMaxWidth(frameWidth);
|
||||
label->setMaxLines(1);
|
||||
m_label = static_cast<Label*>(m_layout->addChild(std::move(label)));
|
||||
@@ -233,14 +233,14 @@ void WallpaperTile::applyVisualState() {
|
||||
m_thumb->setTint(active ? rgba(1.0f, 1.0f, 1.0f, 1.0f) : rgba(0.5f, 0.5f, 0.5f, 1.0f));
|
||||
|
||||
const float outlineWidth = Style::borderWidth * 3.0f;
|
||||
ThemeColor borderColor = active ? roleColor(ColorRole::Hover) : roleColor(ColorRole::Outline);
|
||||
ThemeColor frameBg = roleColor(ColorRole::SurfaceVariant);
|
||||
ColorSpec borderColor = active ? colorSpecFromRole(ColorRole::Hover) : colorSpecFromRole(ColorRole::Outline);
|
||||
ColorSpec frameBg = colorSpecFromRole(ColorRole::SurfaceVariant);
|
||||
|
||||
m_thumbBox->setFill(frameBg);
|
||||
if (m_entry.isDir) {
|
||||
// Folder tiles hide the image node, so draw the state outline on the frame.
|
||||
m_thumbBox->setBorder(borderColor, outlineWidth);
|
||||
m_thumb->setBorder(roleColor(ColorRole::Outline), outlineWidth);
|
||||
m_thumb->setBorder(colorSpecFromRole(ColorRole::Outline), outlineWidth);
|
||||
} else {
|
||||
m_thumbBox->clearBorder();
|
||||
m_thumb->setBorder(borderColor, outlineWidth);
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace {
|
||||
constexpr Logger kLog("wallpaper");
|
||||
|
||||
Color resolveWallpaperFillColor(const WallpaperConfig& config, const WaylandOutput& output) {
|
||||
const ThemeColor* fillColor = nullptr;
|
||||
const ColorSpec* fillColor = nullptr;
|
||||
if (const auto* ovr = findWallpaperMonitorOverride(config, output); ovr != nullptr && ovr->fillColor) {
|
||||
fillColor = &*ovr->fillColor;
|
||||
} else if (config.fillColor) {
|
||||
@@ -179,7 +179,7 @@ namespace {
|
||||
if (fillColor == nullptr) {
|
||||
return rgba(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
return resolveThemeColor(*fillColor);
|
||||
return resolveColorSpec(*fillColor);
|
||||
}
|
||||
|
||||
bool parseColorWallpaperPath(std::string_view path, Color& out) {
|
||||
|
||||
+15
-15
@@ -18,7 +18,7 @@ namespace noctalia::theme {
|
||||
return rgbHex(it->second & 0x00FFFFFFU);
|
||||
}
|
||||
|
||||
Color toThemeColor(const ::Color& color) {
|
||||
Color toUiColor(const ::Color& color) {
|
||||
auto toByte = [](float value) { return static_cast<int>(std::clamp(value, 0.0f, 1.0f) * 255.0f + 0.5f); };
|
||||
return Color(toByte(color.r), toByte(color.g), toByte(color.b));
|
||||
}
|
||||
@@ -33,20 +33,20 @@ namespace noctalia::theme {
|
||||
} // namespace
|
||||
|
||||
TokenMap expandFixedPaletteMode(const ::Palette& palette, bool isDark) {
|
||||
const Color primary = toThemeColor(palette.primary);
|
||||
const Color onPrimary = toThemeColor(palette.onPrimary);
|
||||
const Color secondary = toThemeColor(palette.secondary);
|
||||
const Color onSecondary = toThemeColor(palette.onSecondary);
|
||||
const Color tertiary = toThemeColor(palette.tertiary);
|
||||
const Color onTertiary = toThemeColor(palette.onTertiary);
|
||||
const Color error = toThemeColor(palette.error);
|
||||
const Color onError = toThemeColor(palette.onError);
|
||||
const Color surface = toThemeColor(palette.surface);
|
||||
const Color onSurface = toThemeColor(palette.onSurface);
|
||||
const Color surfaceVariant = toThemeColor(palette.surfaceVariant);
|
||||
const Color onSurfaceVariant = toThemeColor(palette.onSurfaceVariant);
|
||||
const Color outlineRaw = toThemeColor(palette.outline);
|
||||
const Color shadow = toThemeColor(palette.shadow);
|
||||
const Color primary = toUiColor(palette.primary);
|
||||
const Color onPrimary = toUiColor(palette.onPrimary);
|
||||
const Color secondary = toUiColor(palette.secondary);
|
||||
const Color onSecondary = toUiColor(palette.onSecondary);
|
||||
const Color tertiary = toUiColor(palette.tertiary);
|
||||
const Color onTertiary = toUiColor(palette.onTertiary);
|
||||
const Color error = toUiColor(palette.error);
|
||||
const Color onError = toUiColor(palette.onError);
|
||||
const Color surface = toUiColor(palette.surface);
|
||||
const Color onSurface = toUiColor(palette.onSurface);
|
||||
const Color surfaceVariant = toUiColor(palette.surfaceVariant);
|
||||
const Color onSurfaceVariant = toUiColor(palette.onSurfaceVariant);
|
||||
const Color outlineRaw = toUiColor(palette.outline);
|
||||
const Color shadow = toUiColor(palette.shadow);
|
||||
|
||||
auto makeContainerDark = [](const Color& base) {
|
||||
auto [h, s, l] = base.toHsl();
|
||||
|
||||
@@ -59,14 +59,14 @@ void AudioSpectrum::tick(float deltaMs) {
|
||||
}
|
||||
}
|
||||
|
||||
void AudioSpectrum::setGradient(const ThemeColor& lowColor, const ThemeColor& highColor) {
|
||||
void AudioSpectrum::setGradient(const ColorSpec& lowColor, const ColorSpec& highColor) {
|
||||
m_lowColor = lowColor;
|
||||
m_highColor = highColor;
|
||||
recolorBars();
|
||||
}
|
||||
|
||||
void AudioSpectrum::setGradient(const Color& lowColor, const Color& highColor) {
|
||||
setGradient(fixedColor(lowColor), fixedColor(highColor));
|
||||
setGradient(fixedColorSpec(lowColor), fixedColorSpec(highColor));
|
||||
}
|
||||
|
||||
void AudioSpectrum::setSpacingRatio(float ratio) {
|
||||
@@ -211,8 +211,8 @@ void AudioSpectrum::ensureBarCount(std::size_t count) {
|
||||
}
|
||||
|
||||
void AudioSpectrum::recolorBars() {
|
||||
const Color lowColor = resolveThemeColor(m_lowColor);
|
||||
const Color highColor = resolveThemeColor(m_highColor);
|
||||
const Color lowColor = resolveColorSpec(m_lowColor);
|
||||
const Color highColor = resolveColorSpec(m_highColor);
|
||||
const std::size_t lastIndex = m_bars.empty() ? 0 : m_bars.size() - 1;
|
||||
for (std::size_t i = 0; i < m_bars.size(); ++i) {
|
||||
const float t = lastIndex == 0 ? 0.0f : static_cast<float>(i) / static_cast<float>(lastIndex);
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
AudioSpectrum();
|
||||
|
||||
void setValues(const std::vector<float>& values);
|
||||
void setGradient(const ThemeColor& lowColor, const ThemeColor& highColor);
|
||||
void setGradient(const ColorSpec& lowColor, const ColorSpec& highColor);
|
||||
void setGradient(const Color& lowColor, const Color& highColor);
|
||||
void setSpacingRatio(float ratio);
|
||||
void setOrientation(AudioSpectrumOrientation orientation);
|
||||
@@ -50,8 +50,8 @@ private:
|
||||
std::vector<Box*> m_bars;
|
||||
float m_smoothingTauMs = 60.0f;
|
||||
bool m_converged = true;
|
||||
ThemeColor m_lowColor = roleColor(ColorRole::Primary);
|
||||
ThemeColor m_highColor = roleColor(ColorRole::Primary);
|
||||
ColorSpec m_lowColor = colorSpecFromRole(ColorRole::Primary);
|
||||
ColorSpec m_highColor = colorSpecFromRole(ColorRole::Primary);
|
||||
float m_spacingRatio = 0.5f;
|
||||
AudioSpectrumOrientation m_orientation = AudioSpectrumOrientation::Horizontal;
|
||||
AudioSpectrumLayoutMode m_layoutMode = AudioSpectrumLayoutMode::QuantizedCentered;
|
||||
|
||||
+17
-17
@@ -13,23 +13,23 @@ Box::Box() {
|
||||
m_paletteConn = paletteChanged().connect([this] { applyPalette(); });
|
||||
}
|
||||
|
||||
void Box::setFill(const ThemeColor& color) {
|
||||
void Box::setFill(const ColorSpec& color) {
|
||||
m_fill = color;
|
||||
applyPalette();
|
||||
}
|
||||
|
||||
void Box::setFill(const Color& color) { setFill(fixedColor(color)); }
|
||||
void Box::setFill(const Color& color) { setFill(fixedColorSpec(color)); }
|
||||
|
||||
void Box::setBorder(const ThemeColor& color, float width) {
|
||||
void Box::setBorder(const ColorSpec& color, float width) {
|
||||
m_border = color;
|
||||
m_borderWidth = width;
|
||||
applyPalette();
|
||||
}
|
||||
|
||||
void Box::setBorder(const Color& color, float width) { setBorder(fixedColor(color), width); }
|
||||
void Box::setBorder(const Color& color, float width) { setBorder(fixedColorSpec(color), width); }
|
||||
|
||||
void Box::clearBorder() {
|
||||
m_border = clearThemeColor();
|
||||
m_border = clearColorSpec();
|
||||
m_borderWidth = 0.0f;
|
||||
applyPalette();
|
||||
}
|
||||
@@ -76,20 +76,20 @@ void Box::setFrameSize(float w, float h) {
|
||||
|
||||
void Box::applyPalette() {
|
||||
auto style = m_rect->style();
|
||||
style.fill = resolveThemeColor(m_fill);
|
||||
style.border = resolveThemeColor(m_border);
|
||||
style.fill = resolveColorSpec(m_fill);
|
||||
style.border = resolveColorSpec(m_border);
|
||||
style.borderWidth = m_borderWidth;
|
||||
style.fillMode = FillMode::Solid;
|
||||
m_rect->setStyle(style);
|
||||
}
|
||||
|
||||
void Box::setFlatStyle() {
|
||||
m_fill = roleColor(ColorRole::Surface);
|
||||
m_border = roleColor(ColorRole::Outline);
|
||||
m_fill = colorSpecFromRole(ColorRole::Surface);
|
||||
m_border = colorSpecFromRole(ColorRole::Outline);
|
||||
m_borderWidth = 0.0f;
|
||||
auto style = m_rect->style();
|
||||
style.fill = resolveThemeColor(m_fill);
|
||||
style.border = resolveThemeColor(m_border);
|
||||
style.fill = resolveColorSpec(m_fill);
|
||||
style.border = resolveColorSpec(m_border);
|
||||
style.borderWidth = m_borderWidth;
|
||||
style.fillMode = FillMode::Solid;
|
||||
style.corners = {};
|
||||
@@ -100,12 +100,12 @@ void Box::setFlatStyle() {
|
||||
}
|
||||
|
||||
void Box::setPanelStyle() {
|
||||
m_fill = roleColor(ColorRole::Surface);
|
||||
m_border = roleColor(ColorRole::Outline);
|
||||
m_fill = colorSpecFromRole(ColorRole::Surface);
|
||||
m_border = colorSpecFromRole(ColorRole::Outline);
|
||||
m_borderWidth = Style::borderWidth;
|
||||
auto style = m_rect->style();
|
||||
style.fill = resolveThemeColor(m_fill);
|
||||
style.border = resolveThemeColor(m_border);
|
||||
style.fill = resolveColorSpec(m_fill);
|
||||
style.border = resolveColorSpec(m_border);
|
||||
style.borderWidth = m_borderWidth;
|
||||
style.fillMode = FillMode::Solid;
|
||||
style.corners = {};
|
||||
@@ -116,7 +116,7 @@ void Box::setPanelStyle() {
|
||||
}
|
||||
|
||||
void Box::setCardStyle(float scale) {
|
||||
setFill(roleColor(ColorRole::Surface));
|
||||
setBorder(roleColor(ColorRole::Outline, 0.5f), Style::borderWidth);
|
||||
setFill(colorSpecFromRole(ColorRole::Surface));
|
||||
setBorder(colorSpecFromRole(ColorRole::Outline, 0.5f), Style::borderWidth);
|
||||
setRadius(Style::radiusXl * scale);
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ class Box : public Node {
|
||||
public:
|
||||
Box();
|
||||
|
||||
void setFill(const ThemeColor& color);
|
||||
void setFill(const ColorSpec& color);
|
||||
// Explicit fixed color.
|
||||
void setFill(const Color& color);
|
||||
void setBorder(const ThemeColor& color, float width);
|
||||
void setBorder(const ColorSpec& color, float width);
|
||||
void setBorder(const Color& color, float width);
|
||||
void clearBorder();
|
||||
void setRadius(float radius);
|
||||
@@ -41,8 +41,8 @@ private:
|
||||
void applyPalette();
|
||||
|
||||
RectNode* m_rect = nullptr;
|
||||
ThemeColor m_fill = clearThemeColor();
|
||||
ThemeColor m_border = clearThemeColor();
|
||||
ColorSpec m_fill = clearColorSpec();
|
||||
ColorSpec m_border = clearColorSpec();
|
||||
float m_borderWidth = 0.0f;
|
||||
Signal<>::ScopedConnection m_paletteConn;
|
||||
};
|
||||
|
||||
+81
-65
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
Button::ButtonStateColors makeState(ThemeColor bg, ThemeColor border, ThemeColor label) {
|
||||
Button::ButtonStateColors makeState(ColorSpec bg, ColorSpec border, ColorSpec label) {
|
||||
return Button::ButtonStateColors{
|
||||
.bg = std::move(bg),
|
||||
.border = std::move(border),
|
||||
@@ -26,85 +26,101 @@ namespace {
|
||||
case ButtonVariant::Default:
|
||||
return Button::ButtonPalette{
|
||||
.borderWidth = Style::borderWidth,
|
||||
.normal = makeState(roleColor(ColorRole::SurfaceVariant), roleColor(ColorRole::Outline),
|
||||
roleColor(ColorRole::OnSurface)),
|
||||
.hover = makeState(roleColor(ColorRole::Hover), clearThemeColor(), roleColor(ColorRole::OnHover)),
|
||||
.pressed =
|
||||
makeState(roleColor(ColorRole::Primary), roleColor(ColorRole::Primary), roleColor(ColorRole::OnPrimary)),
|
||||
.disabled =
|
||||
makeState(roleColor(ColorRole::SurfaceVariant, kDisabledAlpha),
|
||||
roleColor(ColorRole::Outline, kDisabledAlpha), roleColor(ColorRole::OnSurface, kDisabledAlpha)),
|
||||
.normal = makeState(colorSpecFromRole(ColorRole::SurfaceVariant), colorSpecFromRole(ColorRole::Outline),
|
||||
colorSpecFromRole(ColorRole::OnSurface)),
|
||||
.hover =
|
||||
makeState(colorSpecFromRole(ColorRole::Hover), clearColorSpec(), colorSpecFromRole(ColorRole::OnHover)),
|
||||
.pressed = makeState(colorSpecFromRole(ColorRole::Primary), colorSpecFromRole(ColorRole::Primary),
|
||||
colorSpecFromRole(ColorRole::OnPrimary)),
|
||||
.disabled = makeState(colorSpecFromRole(ColorRole::SurfaceVariant, kDisabledAlpha),
|
||||
colorSpecFromRole(ColorRole::Outline, kDisabledAlpha),
|
||||
colorSpecFromRole(ColorRole::OnSurface, kDisabledAlpha)),
|
||||
};
|
||||
case ButtonVariant::Secondary:
|
||||
return Button::ButtonPalette{
|
||||
.borderWidth = Style::borderWidth,
|
||||
.normal = makeState(roleColor(ColorRole::Secondary), roleColor(ColorRole::Outline),
|
||||
roleColor(ColorRole::OnSecondary)),
|
||||
.hover = makeState(roleColor(ColorRole::Hover), clearThemeColor(), roleColor(ColorRole::OnHover)),
|
||||
.pressed =
|
||||
makeState(roleColor(ColorRole::Primary), roleColor(ColorRole::Primary), roleColor(ColorRole::OnPrimary)),
|
||||
.normal = makeState(colorSpecFromRole(ColorRole::Secondary), colorSpecFromRole(ColorRole::Outline),
|
||||
colorSpecFromRole(ColorRole::OnSecondary)),
|
||||
.hover =
|
||||
makeState(colorSpecFromRole(ColorRole::Hover), clearColorSpec(), colorSpecFromRole(ColorRole::OnHover)),
|
||||
.pressed = makeState(colorSpecFromRole(ColorRole::Primary), colorSpecFromRole(ColorRole::Primary),
|
||||
colorSpecFromRole(ColorRole::OnPrimary)),
|
||||
|
||||
.disabled = makeState(roleColor(ColorRole::Secondary, kDisabledAlpha),
|
||||
roleColor(ColorRole::Outline, kDisabledAlpha), roleColor(ColorRole::OnSecondary)),
|
||||
.disabled = makeState(colorSpecFromRole(ColorRole::Secondary, kDisabledAlpha),
|
||||
colorSpecFromRole(ColorRole::Outline, kDisabledAlpha),
|
||||
colorSpecFromRole(ColorRole::OnSecondary)),
|
||||
};
|
||||
case ButtonVariant::Destructive:
|
||||
return Button::ButtonPalette{
|
||||
.borderWidth = Style::borderWidth,
|
||||
.normal =
|
||||
makeState(roleColor(ColorRole::Error), roleColor(ColorRole::Outline), roleColor(ColorRole::OnError)),
|
||||
.hover = makeState(roleColor(ColorRole::Hover), clearThemeColor(), roleColor(ColorRole::OnHover)),
|
||||
.pressed = makeState(roleColor(ColorRole::Error), roleColor(ColorRole::Error), roleColor(ColorRole::OnError)),
|
||||
.disabled = makeState(roleColor(ColorRole::Error, kDisabledAlpha),
|
||||
roleColor(ColorRole::Outline, kDisabledAlpha), roleColor(ColorRole::OnError)),
|
||||
.normal = makeState(colorSpecFromRole(ColorRole::Error), colorSpecFromRole(ColorRole::Outline),
|
||||
colorSpecFromRole(ColorRole::OnError)),
|
||||
.hover =
|
||||
makeState(colorSpecFromRole(ColorRole::Hover), clearColorSpec(), colorSpecFromRole(ColorRole::OnHover)),
|
||||
.pressed = makeState(colorSpecFromRole(ColorRole::Error), colorSpecFromRole(ColorRole::Error),
|
||||
colorSpecFromRole(ColorRole::OnError)),
|
||||
.disabled =
|
||||
makeState(colorSpecFromRole(ColorRole::Error, kDisabledAlpha),
|
||||
colorSpecFromRole(ColorRole::Outline, kDisabledAlpha), colorSpecFromRole(ColorRole::OnError)),
|
||||
};
|
||||
case ButtonVariant::Outline:
|
||||
return Button::ButtonPalette{
|
||||
.borderWidth = Style::borderWidth,
|
||||
.normal =
|
||||
makeState(roleColor(ColorRole::Surface), roleColor(ColorRole::Outline), roleColor(ColorRole::OnSurface)),
|
||||
.hover = makeState(roleColor(ColorRole::Hover), clearThemeColor(), roleColor(ColorRole::OnHover)),
|
||||
.normal = makeState(colorSpecFromRole(ColorRole::Surface), colorSpecFromRole(ColorRole::Outline),
|
||||
colorSpecFromRole(ColorRole::OnSurface)),
|
||||
.hover =
|
||||
makeState(colorSpecFromRole(ColorRole::Hover), clearColorSpec(), colorSpecFromRole(ColorRole::OnHover)),
|
||||
|
||||
.pressed =
|
||||
makeState(roleColor(ColorRole::Primary), roleColor(ColorRole::Primary), roleColor(ColorRole::OnPrimary)),
|
||||
.disabled =
|
||||
makeState(roleColor(ColorRole::Surface, kDisabledAlpha), roleColor(ColorRole::Outline, kDisabledAlpha),
|
||||
roleColor(ColorRole::OnSurface, kDisabledAlpha)),
|
||||
.pressed = makeState(colorSpecFromRole(ColorRole::Primary), colorSpecFromRole(ColorRole::Primary),
|
||||
colorSpecFromRole(ColorRole::OnPrimary)),
|
||||
.disabled = makeState(colorSpecFromRole(ColorRole::Surface, kDisabledAlpha),
|
||||
colorSpecFromRole(ColorRole::Outline, kDisabledAlpha),
|
||||
colorSpecFromRole(ColorRole::OnSurface, kDisabledAlpha)),
|
||||
};
|
||||
case ButtonVariant::Ghost:
|
||||
return Button::ButtonPalette{
|
||||
.borderWidth = 0.0f,
|
||||
.normal = makeState(clearThemeColor(), clearThemeColor(), roleColor(ColorRole::OnSurface)),
|
||||
.hover = makeState(roleColor(ColorRole::Hover), clearThemeColor(), roleColor(ColorRole::OnHover)),
|
||||
.pressed =
|
||||
makeState(roleColor(ColorRole::SurfaceVariant), clearThemeColor(), roleColor(ColorRole::OnSurface)),
|
||||
.disabled = makeState(clearThemeColor(), clearThemeColor(), roleColor(ColorRole::OnSurface, kDisabledAlpha)),
|
||||
.normal = makeState(clearColorSpec(), clearColorSpec(), colorSpecFromRole(ColorRole::OnSurface)),
|
||||
.hover =
|
||||
makeState(colorSpecFromRole(ColorRole::Hover), clearColorSpec(), colorSpecFromRole(ColorRole::OnHover)),
|
||||
.pressed = makeState(colorSpecFromRole(ColorRole::SurfaceVariant), clearColorSpec(),
|
||||
colorSpecFromRole(ColorRole::OnSurface)),
|
||||
.disabled =
|
||||
makeState(clearColorSpec(), clearColorSpec(), colorSpecFromRole(ColorRole::OnSurface, kDisabledAlpha)),
|
||||
};
|
||||
case ButtonVariant::Accent:
|
||||
return Button::ButtonPalette{
|
||||
.borderWidth = 0.0f,
|
||||
.normal = makeState(roleColor(ColorRole::Primary), clearThemeColor(), roleColor(ColorRole::OnPrimary)),
|
||||
.hover = makeState(roleColor(ColorRole::Hover), clearThemeColor(), roleColor(ColorRole::OnHover)),
|
||||
.pressed = makeState(roleColor(ColorRole::Primary), clearThemeColor(), roleColor(ColorRole::OnPrimary)),
|
||||
.disabled = makeState(roleColor(ColorRole::Primary, kDisabledAlpha), clearThemeColor(),
|
||||
roleColor(ColorRole::OnPrimary)),
|
||||
.normal = makeState(colorSpecFromRole(ColorRole::Primary), clearColorSpec(),
|
||||
colorSpecFromRole(ColorRole::OnPrimary)),
|
||||
.hover =
|
||||
makeState(colorSpecFromRole(ColorRole::Hover), clearColorSpec(), colorSpecFromRole(ColorRole::OnHover)),
|
||||
.pressed = makeState(colorSpecFromRole(ColorRole::Primary), clearColorSpec(),
|
||||
colorSpecFromRole(ColorRole::OnPrimary)),
|
||||
.disabled = makeState(colorSpecFromRole(ColorRole::Primary, kDisabledAlpha), clearColorSpec(),
|
||||
colorSpecFromRole(ColorRole::OnPrimary)),
|
||||
};
|
||||
case ButtonVariant::Tab:
|
||||
return Button::ButtonPalette{
|
||||
.borderWidth = 0.0f,
|
||||
.normal = makeState(clearThemeColor(), clearThemeColor(), roleColor(ColorRole::OnSurface)),
|
||||
.hover = makeState(roleColor(ColorRole::Hover), clearThemeColor(), roleColor(ColorRole::OnHover)),
|
||||
.pressed =
|
||||
makeState(roleColor(ColorRole::SurfaceVariant), clearThemeColor(), roleColor(ColorRole::OnSurface)),
|
||||
.disabled = makeState(clearThemeColor(), clearThemeColor(), roleColor(ColorRole::OnSurface)),
|
||||
.normal = makeState(clearColorSpec(), clearColorSpec(), colorSpecFromRole(ColorRole::OnSurface)),
|
||||
.hover =
|
||||
makeState(colorSpecFromRole(ColorRole::Hover), clearColorSpec(), colorSpecFromRole(ColorRole::OnHover)),
|
||||
.pressed = makeState(colorSpecFromRole(ColorRole::SurfaceVariant), clearColorSpec(),
|
||||
colorSpecFromRole(ColorRole::OnSurface)),
|
||||
.disabled = makeState(clearColorSpec(), clearColorSpec(), colorSpecFromRole(ColorRole::OnSurface)),
|
||||
};
|
||||
case ButtonVariant::TabActive:
|
||||
return Button::ButtonPalette{
|
||||
.borderWidth = 0.0f,
|
||||
.normal = makeState(roleColor(ColorRole::Primary), clearThemeColor(), roleColor(ColorRole::OnPrimary)),
|
||||
.hover = makeState(roleColor(ColorRole::Primary), clearThemeColor(), roleColor(ColorRole::OnPrimary)),
|
||||
.pressed = makeState(roleColor(ColorRole::Primary), clearThemeColor(), roleColor(ColorRole::OnPrimary)),
|
||||
.disabled = makeState(roleColor(ColorRole::Primary, kDisabledAlpha), clearThemeColor(),
|
||||
roleColor(ColorRole::OnPrimary)),
|
||||
.normal = makeState(colorSpecFromRole(ColorRole::Primary), clearColorSpec(),
|
||||
colorSpecFromRole(ColorRole::OnPrimary)),
|
||||
.hover = makeState(colorSpecFromRole(ColorRole::Primary), clearColorSpec(),
|
||||
colorSpecFromRole(ColorRole::OnPrimary)),
|
||||
.pressed = makeState(colorSpecFromRole(ColorRole::Primary), clearColorSpec(),
|
||||
colorSpecFromRole(ColorRole::OnPrimary)),
|
||||
.disabled = makeState(colorSpecFromRole(ColorRole::Primary, kDisabledAlpha), clearColorSpec(),
|
||||
colorSpecFromRole(ColorRole::OnPrimary)),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -303,9 +319,9 @@ void Button::applyVariant() {
|
||||
// button has been painted, applyVisualState() must compare against the
|
||||
// previous targets so variant/palette changes actually propagate.
|
||||
if (!m_visualStateInitialized) {
|
||||
m_targetBg = resolveThemeColor(m_palette.normal.bg);
|
||||
m_targetBorder = resolveThemeColor(m_palette.normal.border);
|
||||
m_targetLabel = resolveThemeColor(m_palette.normal.label);
|
||||
m_targetBg = resolveColorSpec(m_palette.normal.bg);
|
||||
m_targetBorder = resolveColorSpec(m_palette.normal.border);
|
||||
m_targetLabel = resolveColorSpec(m_palette.normal.label);
|
||||
}
|
||||
applyVisualState();
|
||||
}
|
||||
@@ -388,21 +404,21 @@ void Button::resolveVisualStateColors(Color& targetBg, Color& targetBorder, Colo
|
||||
bool isPressed = m_enabled && pressed();
|
||||
|
||||
if (!m_enabled) {
|
||||
targetBg = resolveThemeColor(m_palette.disabled.bg);
|
||||
targetBorder = resolveThemeColor(m_palette.disabled.border);
|
||||
targetLabel = resolveThemeColor(m_palette.disabled.label);
|
||||
targetBg = resolveColorSpec(m_palette.disabled.bg);
|
||||
targetBorder = resolveColorSpec(m_palette.disabled.border);
|
||||
targetLabel = resolveColorSpec(m_palette.disabled.label);
|
||||
} else if (isPressed) {
|
||||
targetBg = resolveThemeColor(m_palette.pressed.bg);
|
||||
targetBorder = resolveThemeColor(m_palette.pressed.border);
|
||||
targetLabel = resolveThemeColor(m_palette.pressed.label);
|
||||
targetBg = resolveColorSpec(m_palette.pressed.bg);
|
||||
targetBorder = resolveColorSpec(m_palette.pressed.border);
|
||||
targetLabel = resolveColorSpec(m_palette.pressed.label);
|
||||
} else if (isHovered) {
|
||||
targetBg = resolveThemeColor(m_palette.hover.bg);
|
||||
targetBorder = resolveThemeColor(m_palette.hover.border);
|
||||
targetLabel = resolveThemeColor(m_palette.hover.label);
|
||||
targetBg = resolveColorSpec(m_palette.hover.bg);
|
||||
targetBorder = resolveColorSpec(m_palette.hover.border);
|
||||
targetLabel = resolveColorSpec(m_palette.hover.label);
|
||||
} else {
|
||||
targetBg = resolveThemeColor(m_palette.normal.bg);
|
||||
targetBorder = resolveThemeColor(m_palette.normal.border);
|
||||
targetLabel = resolveThemeColor(m_palette.normal.label);
|
||||
targetBg = resolveColorSpec(m_palette.normal.bg);
|
||||
targetBorder = resolveColorSpec(m_palette.normal.border);
|
||||
targetLabel = resolveColorSpec(m_palette.normal.label);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user