fix: update color format in fastfetch scripts for compatibility
This commit is contained in:
@@ -8,7 +8,13 @@
|
|||||||
|
|
||||||
file="$HOME/.config/fish/conf.d/60-fetch.fish"
|
file="$HOME/.config/fish/conf.d/60-fetch.fish"
|
||||||
|
|
||||||
sed -i -E "s/(set -g fetch_color\s+\"#)([0-9a-fA-F]{6})(\")/\1${colorHex}\3/" "$file" || {
|
# "#rrggbb" format is only available in and after fastfetch v2.42.0,
|
||||||
|
# so we use the equivalent "ANSI Escape Sequences" format for compatibility.
|
||||||
|
# Luckily we have a helper function that can convert something like "rrggbb"
|
||||||
|
# into "\033[38;2;rrr;ggg;bbbm", which was meant to be used in log messages.
|
||||||
|
colorAnsi=$(color_ansi "$colorHex" | sed -E "s/(.\[)([0-9;\]+)(m)/\2/")
|
||||||
|
|
||||||
|
sed -i -E "s/(set -g fetch_color\s+\")([0-9;]+)(\")/\1${colorAnsi}\3/" "$file" || {
|
||||||
log_error "Failed to edit ${file}"
|
log_error "Failed to edit ${file}"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ if not set -q fetch_logo_type
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not set -q fetch_color
|
if not set -q fetch_color
|
||||||
set -g fetch_color "#89b4fa"
|
set -g fetch_color "38;2;137;180;250"
|
||||||
end
|
end
|
||||||
|
|
||||||
if test "$fetch_logo_type" = symbols
|
if test "$fetch_logo_type" = symbols
|
||||||
|
|||||||
Reference in New Issue
Block a user