Merge pull request #703 from acdcbyl/main

Matugen: fix spicetify theme work for predefined colors && fix `hex_tripped` does not work
This commit is contained in:
Lysec
2025-11-10 15:33:38 +01:00
committed by GitHub
2 changed files with 38 additions and 32 deletions

View File

@@ -1,27 +1,27 @@
[Comfy]
text = {{ colors.on_surface.default.hex_stripped }}
subtext = {{ colors.on_surface_variant.default.hex_stripped }}
main = {{ colors.surface.default.hex_stripped }}
main-elevated = {{ colors.surface_bright.default.hex_stripped }}
main-transition = {{ colors.surface_container_lowest.default.hex_stripped }}
highlight = {{ colors.surface_container_low.default.hex_stripped }}
highlight-elevated = {{ colors.surface_container_highest.default.hex_stripped }}
sidebar = {{ colors.surface.default.hex_stripped }}
player = {{ colors.scrim.default.hex_stripped }}
card = {{ colors.scrim.default.hex_stripped }}
shadow = {{ colors.scrim.default.hex_stripped }}
selected-row = {{ colors.on_surface.default.hex_stripped }}
button = {{ colors.primary.default.hex_stripped }}
button-active = {{ colors.primary_fixed.default.hex_stripped }}
button-disabled = {{ colors.primary_fixed_dim.default.hex_stripped }}
tab-active = {{ colors.surface.default.hex_stripped }}
notification = {{ colors.tertiary.default.hex_stripped }}
notification-error = {{ colors.error.default.hex_stripped }}
misc = {{ colors.scrim.default.hex_stripped }}
play-button = {{ colors.secondary.default.hex_stripped }}
play-button-active = {{ colors.secondary_fixed.default.hex_stripped }}
progress-fg = {{ colors.primary.default.hex_stripped }}
progress-bg = {{ colors.surface.default.hex_stripped }}
heart = {{ colors.error.default.hex_stripped }}
pagelink-active = {{ colors.on_tertiary_container.default.hex_stripped }}
radio-btn-active = {{ colors.on_tertiary_container.default.hex_stripped }}
text = {{colors.on_surface.default.hex_stripped}}
subtext = {{colors.on_surface_variant.default.hex_stripped}}
main = {{colors.surface.default.hex_stripped}}
main-elevated = {{colors.surface.default.hex_stripped}}
main-transition = {{colors.surface_container_lowest.default.hex_stripped}}
highlight = {{colors.surface_container_low.default.hex_stripped}}
highlight-elevated = {{colors.surface_container_highest.default.hex_stripped}}
sidebar = {{colors.surface.default.hex_stripped}}
player = {{colors.surface.default.hex_stripped}}
card = {{colors.surface.default.hex_stripped}}
shadow = {{colors.surface.default.hex_stripped}}
selected-row = {{colors.on_surface.default.hex_stripped}}
button = {{colors.primary.default.hex_stripped}}
button-active = {{colors.primary.default.hex_stripped}}
button-disabled = {{colors.primary.default.hex_stripped}}
tab-active = {{colors.surface.default.hex_stripped}}
notification = {{colors.tertiary.default.hex_stripped}}
notification-error = {{colors.error.default.hex_stripped}}
misc = {{colors.surface.default.hex_stripped}}
play-button = {{colors.secondary.default.hex_stripped}}
play-button-active = {{colors.secondary.default.hex_stripped}}
progress-fg = {{colors.primary.default.hex_stripped}}
progress-bg = {{colors.surface.default.hex_stripped}}
heart = {{colors.error.default.hex_stripped}}
pagelink-active = {{colors.on_tertiary_container.default.hex_stripped}}
radio-btn-active = {{colors.on_tertiary_container.default.hex_stripped}}

View File

@@ -222,14 +222,20 @@ Singleton {
}
function replaceColorsInFile(filePath, colors) {
// This handles both ".hex" and ".hex_stripped" the EXACT same way. Our predefined color schemes are
// always RRGGBB without alpha so this is fine and keeps compatibility with matugen.
let script = ""
Object.keys(colors).forEach(colorKey => {
const colorValue = colors[colorKey].default.hex
const escapedColor = colorValue.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
script += `sed -i 's/{{colors\\.${colorKey}\\.default\\.hex\\(_stripped\\)\\?}}/${escapedColor}/g' '${filePath}'\n`
})
const hexValue = colors[colorKey].default.hex
const hexStrippedValue = colors[colorKey].default.hex_stripped
const escapedHex = hexValue.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
const escapedHexStripped = hexStrippedValue.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
// replace hex_stripped
script += `sed -i 's/{{colors\\.${colorKey}\\.default\\.hex_stripped}}/${escapedHexStripped}/g' '${filePath}'\n`
// replace hex
script += `sed -i 's/{{colors\\.${colorKey}\\.default\\.hex}}/${escapedHex}/g' '${filePath}'\n`
})
return script
}