mltefive / docs

https://mltefive.github.io/docs/
1 stars 0 forks source link

xterm #42

Open 7dir opened 4 years ago

7dir commented 4 years ago

colors

TERMs path /usr/lib/terminfo

Get and Set XTERM

echo $TERM
export TERM=xterm-256color

check colors script

#!/usr/bin/python

def hrun(start, width, padding=0):
    return [None] * padding + range(start, start+width) + [None] * padding

def vrun(start, width, height, padding=0):
    return [hrun(s, width, padding)
            for s in range(start, start+width*height, width)]

layout = [
    vrun(0, 8, 2),            # 16 standard xterm colors
    vrun(16, 6, 6*6, 1),      # 6x6x6 color cube
    vrun(16 + 6*6*6, 8, 3),   # 24 grey levels
]

def fg_seq(color):
    return '\033[38;5;%dm' % color

def bg_seq(color):
    return '\033[48;5;%dm' % color

reset_seq = '\033[0m'

def color_bar(seq, color, trail):
    if color is None:
        return '%s    %s' % (reset_seq, trail)
    else:
        return '%s %03d%s' % (seq(color), color, trail)

for block in layout:
    print
    for row in block:
        fg_bar = ''.join(color_bar(fg_seq, color, '') for color in row)
        bg_bar = ''.join(color_bar(bg_seq, color, ' ') for color in row)
        print '%s%s    %s%s' % (fg_bar, reset_seq, bg_bar, reset_seq)
7dir commented 4 years ago

set mc colors if linux or xterm console

add to /etc/profile

case $TERM in
     xterm*|rxvt*)
    if [ "$EUID" -ne 0 ]
    then
        alias mc="mc -S modarin256-thin"
        alias mcedit="mcedit -S modarin256-thin"
    else
        alias mc="mc -S modarin256root-thin"
        alias mcedit="mcedit -S modarin256root-thin"
    fi
          ;;
     *)
         # local TITLEBAR=""
    alias mc="mc -S gotar"
    alias mcedit="mcedit -S gotar"
          ;;
    esac