From 4741aba4e85510e6fab5bad1098bd96d0d42ff2b Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Tue, 8 Dec 2020 01:36:52 +0100 Subject: [PATCH] refactor(bash): change method for setting iTerm2 color palette According to iTerm2's documentation, the previous scheme of ^[]Pnrrggbb^[\ is supported but not recommended. --- roles/bash/files/profile | 53 ++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/roles/bash/files/profile b/roles/bash/files/profile index 6da8b41..a645e67 100644 --- a/roles/bash/files/profile +++ b/roles/bash/files/profile @@ -280,35 +280,36 @@ _set_terminal_colors() { # 1: foreground, 2: background, 3: cursor # under the heading "Change the color palette". _set_iterm2_colors() { # 1: foreground, 2: background, 3: cursor local fg="$1" bg="$2" cursor="$3" - local n rgb - while read -r n rgb; do + local key rgb + while read -r key rgb; do _osc_start - printf "P%s%s" "$n" "$rgb" + printf "1337;SetColors=%s=%s" "$key" "${rgb}" _osc_end done <