34 lines
716 B
Bash
Executable File
34 lines
716 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# blob:summary=Print OSC sequences for an Blob color theme
|
|
# blob:hidden=true
|
|
|
|
theme="${1:-$HOME/.local/state/blob/current/theme/colors.toml}"
|
|
|
|
[[ -f $theme ]] || exit 0
|
|
|
|
declare -A COLORS
|
|
|
|
while IFS=$'\t' read -r key value; do
|
|
COLORS[$key]="$value"
|
|
done < <(blob-theme-color --file "$theme" --all)
|
|
|
|
emit_osc() {
|
|
local code="$1"
|
|
local key="$2"
|
|
|
|
[[ -n ${COLORS[$key]:-} ]] || return 0
|
|
printf '\033]%s;%s\007' "$code" "${COLORS[$key]}"
|
|
}
|
|
|
|
emit_osc 10 foreground
|
|
emit_osc 11 background
|
|
emit_osc 12 cursor
|
|
emit_osc 17 selection_background
|
|
emit_osc 19 selection_foreground
|
|
|
|
for i in {0..15}; do
|
|
[[ -n ${COLORS[color$i]:-} ]] || continue
|
|
printf '\033]4;%d;%s\007' "$i" "${COLORS[color$i]}"
|
|
done
|