diff options
Diffstat (limited to 'content/notes/show-xterm-colors.md')
| -rw-r--r-- | content/notes/show-xterm-colors.md | 8 |
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 | |||
| 4 | date: 2023-05-25T12:00:00+02:00 | 4 | date: 2023-05-25T12:00:00+02:00 |
| 5 | type: notes | 5 | type: notes |
| 6 | draft: false | 6 | draft: false |
| 7 | tags: [linux, xterm, palette] | 7 | tags: [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 | ||
| 29 | function showcolors() { | 29 | function 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 | |||
| 44 | read -d $'\a' -s -t 0.1 </dev/tty | 44 | read -d $'\a' -s -t 0.1 </dev/tty |
| 45 | if [ -z "$REPLY" ] | 45 | if [ -z "$REPLY" ] |
| 46 | then | 46 | then |
| 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) |
| 49 | else | 49 | else |
| 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 ]] |
