Simplify theme palette tokens
This commit is contained in:
@@ -20,7 +20,38 @@ else
|
||||
theme_dir="$OMARCHY_PATH/themes/$theme"
|
||||
fi
|
||||
|
||||
bg=$(awk -F'"' '/^background/{print $2}' "$theme_dir/colors.toml")
|
||||
text=$(awk -F'"' '/^foreground/{print $2}' "$theme_dir/colors.toml")
|
||||
theme_color() {
|
||||
local key="$1"
|
||||
local fallback="$2"
|
||||
|
||||
awk -F= -v key="$key" -v fallback="$fallback" '
|
||||
function clean(raw) {
|
||||
gsub(/^[[:space:]]+|[[:space:]]+$/, "", raw)
|
||||
if (raw ~ /^"/) {
|
||||
sub(/^"/, "", raw)
|
||||
sub(/".*$/, "", raw)
|
||||
}
|
||||
return raw
|
||||
}
|
||||
|
||||
{
|
||||
field = $1
|
||||
gsub(/^[[:space:]]+|[[:space:]]+$/, "", field)
|
||||
if (field == key) {
|
||||
print clean($2)
|
||||
found = 1
|
||||
exit
|
||||
}
|
||||
if (field == fallback) fallback_value = clean($2)
|
||||
}
|
||||
|
||||
END {
|
||||
if (!found && fallback_value != "") print fallback_value
|
||||
}
|
||||
' "$theme_dir/colors.toml"
|
||||
}
|
||||
|
||||
bg=$(theme_color background bg)
|
||||
text=$(theme_color foreground fg)
|
||||
|
||||
exec omarchy-plymouth-set "$bg" "$text" "$theme_dir/unlock.png"
|
||||
|
||||
Reference in New Issue
Block a user