From a75ea8ee8e9b3aa9791339b531ab9255057e227f Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Mon, 26 Jul 2021 18:19:33 +0200 Subject: [PATCH] solarize: minor refactor The underscores are an artifact of when this script used to be part of the bash profile and I didn't want the variables to be exposed too much. This is no longer relevant. --- bin/,solarize | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/,solarize b/bin/,solarize index 88bebea..fbc2868 100755 --- a/bin/,solarize +++ b/bin/,solarize @@ -22,11 +22,11 @@ # Either ST or BEL (\a) can be used to end an OSC sequence. However, tmux # requires ST to end its wrapping DCS. if [ -n "$TMUX" ]; then - _OSC=$(printf '\ePtmux;\e\e]') - _ST=$(printf '\a\e\\') + OSC=$(printf '\ePtmux;\e\e]') + ST=$(printf '\a\e\\') else - _OSC=$(printf '\e]') - _ST=$(printf '\a') + OSC=$(printf '\e]') + ST=$(printf '\a') fi # Color definitions (from http://ethanschoonover.com/solarized) @@ -40,7 +40,7 @@ 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" + 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 - awk -v osc="$_OSC" -v st="$_ST" -v ORS="" \ + 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 - awk -v osc="$_OSC" -v st="$_ST" -v ORS="" \ + 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}' \ <