diff --git a/bin/solarize b/bin/solarize index fc95081..88bebea 100755 --- a/bin/solarize +++ b/bin/solarize @@ -40,8 +40,8 @@ fi # under the heading "Change the color palette". set_iterm2_colors() { # 1: foreground, 2: background, 3: cursor while read -r key rgb; do - printf "%s1337;SetColors=%s=%s%s" "$_OSC" "$key" "${rgb}" "$_ST" - done < 4;c;spec - # c -> index of the ANSI color to change [0..15] - # spec -> RGB value of color as rgb:RR/GG/BB - printf "%s4;%s;rgb:%s/%s/%s%s" "$_OSC" "$c" "${rgb:0:2}" "${rgb:2:2}" "${rgb:4:2}" "$_ST" - done < 4;c;spec + # c -> index of the ANSI color to change [0..15] + # spec -> RGB value of color as rgb:RR/GG/BB + awk -v osc="$_OSC" -v st="$_ST" -v ORS="" \ + '{print osc "4;" $1 ";rgb:" substr($2,1,2) "/" substr($2,3,2) "/" substr($2,5,2) st}' \ + < foreground (10), background (11), or cursor (12) - # Pt -> RGB value of color as rgb:RR/GG/BB - printf "%s%s;rgb:%s/%s/%s%s" "$_OSC" "$Ps" "${rgb:0:2}" "${rgb:2:2}" "${rgb:4:2}" "$_ST" - done < foreground (10), background (11), or cursor (12) + # Pt -> RGB value of color as rgb:RR/GG/BB + awk -v osc="$_OSC" -v st="$_ST" -v ORS="" \ + '{print osc $1 ";rgb:" substr($2,1,2) "/" substr($2,3,2) "/" substr($2,5,2) st}' \ + <