Stop cyclic shell color references
Resolve color references iteratively and use the caller's fallback when a reference repeats. Preserve normal palette roles, color parsing and gradient first stops. Reported-by: Aleksej <aleksejhairov@yandex.ru>
This commit is contained in:
1 parent
d3cfd53b99
commit
f5ad8a0b9e
2 files changed
+59
-1
No files matched your search
@@ -49,9 +49,15 @@ QtObject {
|
||||
}
|
||||
|
||||
function flatColor(value, fallback) {
|
||||
var seen = Object.create(null)
|
||||
var token = firstColorToken(value)
|
||||
var role = String(token || "").replace(/^\s+|\s+$/g, "").toLowerCase()
|
||||
if (root.shellValues[role] && root.shellValues[role] !== token) return flatColor(root.shellValues[role], fallback)
|
||||
while (root.shellValues[role] && root.shellValues[role] !== token) {
|
||||
if (seen[role]) return fallback
|
||||
seen[role] = true
|
||||
token = firstColorToken(root.shellValues[role])
|
||||
role = String(token || "").replace(/^\s+|\s+$/g, "").toLowerCase()
|
||||
}
|
||||
if (role === "foreground" || role === "text") return root.foreground
|
||||
if (role === "accent") return root.accent
|
||||
if (role === "urgent") return root.urgent
|
||||
|
||||
Reference in new issue
Block a user