aboutsummaryrefslogtreecommitdiff
path: root/content/notes/show-xterm-colors.md
diff options
context:
space:
mode:
Diffstat (limited to 'content/notes/show-xterm-colors.md')
-rw-r--r--content/notes/show-xterm-colors.md8
1 files changed, 4 insertions, 4 deletions
diff --git a/content/notes/show-xterm-colors.md b/content/notes/show-xterm-colors.md
index a8802fd..88e9856 100644
--- a/content/notes/show-xterm-colors.md
+++ b/content/notes/show-xterm-colors.md
@@ -4,7 +4,7 @@ url: write-iso-usb.html
4date: 2023-05-25T12:00:00+02:00 4date: 2023-05-25T12:00:00+02:00
5type: notes 5type: notes
6draft: false 6draft: false
7tags: [linux, xterm, palette] 7tags: [linux]
8--- 8---
9 9
10- `bash xterm-palette.sh` - will show you number of max colors available 10- `bash xterm-palette.sh` - will show you number of max colors available
@@ -27,7 +27,7 @@ function setbg () {
27} 27}
28 28
29function showcolors() { 29function showcolors() {
30 # Given an integer, display that many colors 30 # Given an integer, display that many colors
31 for ((i=0; i<$1; i++)) 31 for ((i=0; i<$1; i++))
32 do 32 do
33 printf '%4d ' $i 33 printf '%4d ' $i
@@ -44,10 +44,10 @@ printf '\e]4;%d;?\a' 0
44read -d $'\a' -s -t 0.1 </dev/tty 44read -d $'\a' -s -t 0.1 </dev/tty
45if [ -z "$REPLY" ] 45if [ -z "$REPLY" ]
46then 46then
47 # OSC 4 not supported, so we'll fall back to terminfo 47 # OSC 4 not supported, so we'll fall back to terminfo
48 max=$(tput colors) 48 max=$(tput colors)
49else 49else
50 # OSC 4 is supported, so use it for a binary search 50 # OSC 4 is supported, so use it for a binary search
51 min=0 51 min=0
52 max=256 52 max=256
53 while [[ $((min+1)) -lt $max ]] 53 while [[ $((min+1)) -lt $max ]]