diff options
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/cursor | 2 | ||||
| -rwxr-xr-x | bin/tc | 14 | ||||
| -rwxr-xr-x | bin/tf | 5 |
3 files changed, 12 insertions, 9 deletions
@@ -5,7 +5,7 @@ usage="Usage: $0 [black | blue | cyan | gray | green | magenta | orange | red | white | yellow]" cursor() { - case $1 in + case $1 in (0|r|red) set -- '#f00' ;; (1|n|green) set -- '#5f5' ;; (2|b|blue) set -- '#55f' ;; @@ -1,6 +1,8 @@ -#!/bin/bash +#!/bin/sh -# Set terminal color in xterm and compatibles. +# Set terminal color in xterm and compatibles + +usage="Usage: $0 [black | blue | cyan | gray | green | magenta | orange | red | white | yellow]" color() { case $1 in @@ -11,11 +13,11 @@ color() { (4|y|yellow) bg='#ffffe0' ;; (5|n|green) bg='#e0ffe0' ;; (6|o|orange) bg='#fff0f4' ;; - (7|k|black) bg='#111111' fg='#eeeeee' ;; - (*) echo "$0: unknown color $1">&2; exit 1 ;; + (7|k|black) bg='#000000' fg='#eeeeee' ;; esac + printf '\e]11;'${bg:-#ffffff}'\e\' # Set background color. + printf '\e]10;'${fg:-#000000}'\e\' # Set foreground color. } +case $1 in -*) echo "$usage" >&2; exit 1;; esac color ${1:-$((RANDOM % 7))} -printf '\E]11;'${bg:-#ffffff}'\E\' -printf '\E]10;'${fg:-#000000}'\E\' @@ -8,6 +8,7 @@ terminal_font() { case $1 in (m|menlo|mono) fn=menlo fs=$2 ;; (f|fixed|6x13) fn=6x13 fs=13 ;; + (s|sf) fn='SF Mono Light' fs=8 ;; ([0-9]*) fs=$1 ;; (*) fn=$1 fs=$2 ;; esac @@ -26,7 +27,7 @@ iterm2_font() { } case $TERM_PROGRAM in - (Apple_Terminal) terminal_font $@ ;; - (iTerm.app) iterm2_font $@ ;; + (Apple_Terminal) terminal_font "$@" ;; + (iTerm.app) iterm2_font "$@" ;; (*) die 'not supported' ;; esac |
