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

+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 = {}