Rename the Color singleton to avoid the Qt 6.12 clash

This commit is contained in:
SirBlob committed 2026-10-09 19:22:08 -04:00
1 parent 97854006b5
commit d92290c06c
93 files changed
+342 -342

No files matched your search

+6 -6
View File
@@ -22,7 +22,7 @@ QtObject {
}
function value(section, key) {
var v = Color.shellValues[section + "." + key]
var v = Colors.shellValues[section + "." + key]
return (v === undefined || v === null) ? "" : v
}
@@ -39,7 +39,7 @@ QtObject {
var seen = {}
while (s.match(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/) && !seen[s]) {
seen[s] = true
var next = Color.shellValues[s]
var next = Colors.shellValues[s]
if (next === undefined || next === null || String(next).length === 0) break
s = String(next).replace(/^\s+|\s+$/g, "")
}
@@ -68,10 +68,10 @@ QtObject {
var s = String(color || "").replace(/^\s+|\s+$/g, "")
var role = s.toLowerCase()
if (role === "foreground" || role === "text") return cssColor(Color.foreground, a)
if (role === "accent") return cssColor(Color.accent, a)
if (role === "urgent") return cssColor(Color.urgent, a)
if (role === "background") return cssColor(Color.background, a)
if (role === "foreground" || role === "text") return cssColor(Colors.foreground, a)
if (role === "accent") return cssColor(Colors.accent, a)
if (role === "urgent") return cssColor(Colors.urgent, a)
if (role === "background") return cssColor(Colors.background, a)
if (role === "transparent") return "transparent"
return Geometry.canonicalColor(s, a)
}
@@ -186,7 +186,7 @@ QtObject {
property var themeShellValues: ({})
property var userShellValues: ({})
// Single TOML walker for shell.toml. Both Color (surface roles) and Style
// Single TOML walker for shell.toml. Both Colors (surface roles) and Style
// (typography, spacing, bar, control states) consume the resulting dict.
// Accepts quoted strings, bare numeric values, bare width lists, and bare
// role names; tolerates inline comments. Numbers are kept as strings here —
+22 -22
View File
@@ -3,7 +3,7 @@ import QtQuick
import Quickshell
import Quickshell.Io
// Shared structural style tokens for the shell. Color is the palette
// Shared structural style tokens for the shell. Colors is the palette
// singleton; Style holds everything else themes can influence — corner
// rounding, gap to screen edges, state affordances, spacing, typography
// scale, and bar dimensions.
@@ -113,27 +113,27 @@ QtObject {
}
function resolveStateColor(token, foreground, accent, urgent, fallback) {
var fb = fallback || foreground || Color.foreground
var fb = fallback || foreground || Colors.foreground
var s = String(token || "").replace(/^\s+|\s+$/g, "")
var role = s.toLowerCase()
if (role === "foreground" || role === "text") return foreground || Color.foreground
if (role === "accent") return accent || Color.accent
if (role === "urgent") return urgent || Color.urgent
if (role === "background") return Color.background
if (role === "foreground" || role === "text") return foreground || Colors.foreground
if (role === "accent") return accent || Colors.accent
if (role === "urgent") return urgent || Colors.urgent
if (role === "background") return Colors.background
if (role === "transparent") return Qt.rgba(0, 0, 0, 0)
return colorFromHex(s, fb)
}
function normalStateColor(foreground, accent, urgent) {
return resolveStateColor(normalColorToken, foreground, accent, urgent, foreground || Color.foreground)
return resolveStateColor(normalColorToken, foreground, accent, urgent, foreground || Colors.foreground)
}
function hoverStateColor(foreground, accent, urgent) {
return resolveStateColor(hoverColorToken, foreground, accent, urgent, foreground || Color.foreground)
return resolveStateColor(hoverColorToken, foreground, accent, urgent, foreground || Colors.foreground)
}
function selectedStateColor(foreground, accent, urgent) {
return resolveStateColor(selectedColorToken, foreground, accent, urgent, foreground || Color.foreground)
return resolveStateColor(selectedColorToken, foreground, accent, urgent, foreground || Colors.foreground)
}
function pressedStateColor(foreground, accent, urgent) {
@@ -148,7 +148,7 @@ QtObject {
}
function selectionStateColor(foreground, accent, urgent) {
return resolveStateColor(selectionColorToken, foreground, accent, urgent, foreground || Color.foreground)
return resolveStateColor(selectionColorToken, foreground, accent, urgent, foreground || Colors.foreground)
}
function normalFillFor(foreground, accent, urgent) { return Util.alpha(normalStateColor(foreground, accent, urgent), normalFillAlpha) }
@@ -186,17 +186,17 @@ QtObject {
}
// Convenience colors resolved against the foundational palette.
readonly property color normalFill: normalFillFor(Color.foreground, Color.accent, Color.urgent)
readonly property color hoverFill: hoverFillFor(Color.foreground, Color.accent, Color.urgent)
readonly property color selectedFill: selectedFillFor(Color.foreground, Color.accent, Color.urgent)
readonly property color pressedFill: pressedFillFor(Color.foreground, Color.accent, Color.urgent)
readonly property color focusFillColor: focusFillFor(Color.foreground, Color.accent, Color.urgent)
readonly property color normalBorderColor: normalBorderFor(Color.foreground, Color.accent, Color.urgent)
readonly property color hoverBorderColor: hoverBorderFor(Color.foreground, Color.accent, Color.urgent)
readonly property color selectedBorderColor: selectedBorderFor(Color.foreground, Color.accent, Color.urgent)
readonly property color focusBorderColor: focusBorderFor(Color.foreground, Color.accent, Color.urgent)
readonly property color selectedAccentFill: Util.alpha(Color.accent, selectedFillAlpha)
readonly property color selectionFill: selectionFillFor(Color.foreground, Color.accent, Color.urgent)
readonly property color normalFill: normalFillFor(Colors.foreground, Colors.accent, Colors.urgent)
readonly property color hoverFill: hoverFillFor(Colors.foreground, Colors.accent, Colors.urgent)
readonly property color selectedFill: selectedFillFor(Colors.foreground, Colors.accent, Colors.urgent)
readonly property color pressedFill: pressedFillFor(Colors.foreground, Colors.accent, Colors.urgent)
readonly property color focusFillColor: focusFillFor(Colors.foreground, Colors.accent, Colors.urgent)
readonly property color normalBorderColor: normalBorderFor(Colors.foreground, Colors.accent, Colors.urgent)
readonly property color hoverBorderColor: hoverBorderFor(Colors.foreground, Colors.accent, Colors.urgent)
readonly property color selectedBorderColor: selectedBorderFor(Colors.foreground, Colors.accent, Colors.urgent)
readonly property color focusBorderColor: focusBorderFor(Colors.foreground, Colors.accent, Colors.urgent)
readonly property color selectedAccentFill: Util.alpha(Colors.accent, selectedFillAlpha)
readonly property color selectionFill: selectionFillFor(Colors.foreground, Colors.accent, Colors.urgent)
// ---------------------------------------------------------- spacing
//
@@ -379,7 +379,7 @@ QtObject {
}
// Pull typography, bar dimensions, state tokens, and spacing out of the
// shell.toml dict that Color already parsed. Called by Color.loadShell so
// shell.toml dict that Colors already parsed. Called by Colors.loadShell so
// a single parse pass feeds both singletons.
function applyShellValues(values) {
var fontOut = {}
+1 -1
View File
@@ -3,7 +3,7 @@ import Quickshell
import QtQuick
// Shared utility helpers used across plugins. Pure functions only — no
// state. Anything stateful belongs on Color, Style, or a service.
// state. Anything stateful belongs on Colors, Style, or a service.
QtObject {
id: root
+1 -1
View File
@@ -1,5 +1,5 @@
module qs.Commons
singleton Border 1.0 Border.qml
singleton Color 1.0 Color.qml
singleton Colors 1.0 Colors.qml
singleton Style 1.0 Style.qml
singleton Util 1.0 Util.qml