Skip to content

Instantly share code, notes, and snippets.

@sapslaj
Last active August 29, 2015 13:57
Show Gist options
  • Save sapslaj/9728357 to your computer and use it in GitHub Desktop.
Save sapslaj/9728357 to your computer and use it in GitHub Desktop.
Color scheme scripts
#!/usr/bin/bash
#
# This file echoes a bunch of color codes to the
# terminal to demonstrate what's available. Each
# line is the color code of one foreground color,
# out of 17 (default + 16 escapes), followed by a
# test use of that color on all nine background
# colors (default + 8 escapes).
#
T='gYw' # The test text
echo -e "\n 40m 41m 42m 43m\
44m 45m 46m 47m";
for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \
'1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \
' 36m' '1;36m' ' 37m' '1;37m';
do FG=${FGs// /}
echo -en " $FGs \033[$FG $T "
for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
do echo -en "$EINS \033[$FG\033[$BG $T \033[0m";
done
echo;
done
echo
#!/usr/bin/bash
# Original: http://frexx.de/xterm-256-notes/ [dead link 2013-11-21]
# http://frexx.de/xterm-256-notes/data/colortable16.sh [dead link 2013-11-21]
# Modified by Aaron Griffin
# and further by Kazuo Teramoto
FGNAMES=(' black ' ' red ' ' green ' ' yellow' ' blue ' 'magenta' ' cyan ' ' white ')
BGNAMES=('DFT' 'BLK' 'RED' 'GRN' 'YEL' 'BLU' 'MAG' 'CYN' 'WHT')
echo " ┌──────────────────────────────────────────────────────────────────────────┐"
for b in {0..8}; do
((b>0)) && bg=$((b+39))
echo -en "\033[0m ${BGNAMES[b]} │ "
for f in {0..7}; do
echo -en "\033[${bg}m\033[$((f+30))m ${FGNAMES[f]} "
done
echo -en "\033[0m │"
echo -en "\033[0m\n\033[0m │ "
for f in {0..7}; do
echo -en "\033[${bg}m\033[1;$((f+30))m ${FGNAMES[f]} "
done
echo -en "\033[0m │"
echo -e "\033[0m"
((b<8)) &&
echo " ├──────────────────────────────────────────────────────────────────────────┤"
done
echo " └──────────────────────────────────────────────────────────────────────────┘"
#!/usr/bin/bash
# Original: http://frexx.de/xterm-256-notes/ [dead link 2013-11-21]
# http://frexx.de/xterm-256-notes/data/colortable16.sh [dead link 2013-11-21]
# Modified by Aaron Griffin
# and further by Kazuo Teramoto
FGNAMES=(' black ' ' red ' ' green ' ' yellow' ' blue ' 'magenta' ' cyan ' ' white ')
BGNAMES=('DFT' 'BLK' 'RED' 'GRN' 'YEL' 'BLU' 'MAG' 'CYN' 'WHT')
echo " ----------------------------------------------------------------------------"
for b in $(seq 0 8); do
if [ "$b" -gt 0 ]; then
bg=$(($b+39))
fi
echo -en "\033[0m ${BGNAMES[$b]} : "
for f in $(seq 0 7); do
echo -en "\033[${bg}m\033[$(($f+30))m ${FGNAMES[$f]} "
done
echo -en "\033[0m :"
echo -en "\033[0m\n\033[0m : "
for f in $(seq 0 7); do
echo -en "\033[${bg}m\033[1;$(($f+30))m ${FGNAMES[$f]} "
done
echo -en "\033[0m :"
echo -e "\033[0m"
if [ "$b" -lt 8 ]; then
echo " ----------------------------------------------------------------------------"
fi
done
echo " ----------------------------------------------------------------------------"
#!/usr/bin/env lua
function cl(e)
return string.format('\27[%sm', e)
end
function print_fg(bg, pre)
for fg = 30,37 do
fg = pre..fg
io.write(cl(bg), cl(fg), string.format(' %6s ', fg), cl(0))
end
end
for bg = 40,47 do
io.write(cl(0), ' ', bg, ' ')
print_fg(bg, ' ')
io.write('\n ')
print_fg(bg, '1;')
io.write('\n\n')
end
-- Andres P
#!/usr/bin/bash
#
# ANSI color scheme script featuring Space Invaders
#
# Original: http://crunchbang.org/forums/viewtopic.php?pid=126921%23p126921#p126921
# Modified by lolilolicon
#
f=3 b=4
for j in f b; do
for i in {0..7}; do
printf -v $j$i %b "\e[${!j}${i}m"
done
done
bld=$'\e[1m'
rst=$'\e[0m'
cat << EOF
$f1 ▀▄ ▄▀ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4 ▀▄ ▄▀ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst
$f1 ▄█▀███▀█▄ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4 ▄█▀███▀█▄ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst
$f1█▀███████▀█ $f2▀▀███▀▀███▀▀ $f3▀█▀██▀█▀ $f4█▀███████▀█ $f5▀▀███▀▀███▀▀ $f6▀█▀██▀█▀$rst
$f1▀ ▀▄▄ ▄▄▀ ▀ $f2 ▀█▄ ▀▀ ▄█▀ $f3▀▄ ▄▀ $f4▀ ▀▄▄ ▄▄▀ ▀ $f5 ▀█▄ ▀▀ ▄█▀ $f6▀▄ ▄▀$rst
$bld$f1▄ ▀▄ ▄▀ ▄ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4▄ ▀▄ ▄▀ ▄ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst
$bld$f1█▄█▀███▀█▄█ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4█▄█▀███▀█▄█ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst
$bld$f1▀█████████▀ $f2▀▀▀██▀▀██▀▀▀ $f3▀▀█▀▀█▀▀ $f4▀█████████▀ $f5▀▀▀██▀▀██▀▀▀ $f6▀▀█▀▀█▀▀$rst
$bld$f1 ▄▀ ▀▄ $f2▄▄▀▀ ▀▀ ▀▀▄▄ $f3▄▀▄▀▀▄▀▄ $f4 ▄▀ ▀▄ $f5▄▄▀▀ ▀▀ ▀▀▄▄ $f6▄▀▄▀▀▄▀▄$rst
$f7▌$rst
$f7▌$rst
$f7 ▄█▄ $rst
$f7▄█████████▄$rst
$f7▀▀▀▀▀▀▀▀▀▀▀$rst
EOF
#!/usr/bin/env ruby
# coding: utf-8
# ANSI color scheme script
# Author: Ivaylo Kuzev < Ivo >
# Original: http://crunchbang.org/forums/viewtopic.php?pid=134749%23p134749#p134749
# Modified using Ruby.
CL = "\e[0m"
BO = "\e[1m"
R = "\e[31m"
G = "\e[32m"
Y = "\e[33m"
B = "\e[34m"
P = "\e[35m"
C = "\e[36m"
print <<EOF
#{BO}#{R} ██████ #{CL} #{BO}#{G}██████ #{CL}#{BO}#{Y} ██████#{CL} #{BO}#{B}██████ #{CL} #{BO}#{P} ██████#{CL} #{BO}#{C} ███████#{CL}
#{BO}#{R} ████████#{CL} #{BO}#{G}██ ██ #{CL}#{BO}#{Y}██ #{CL} #{BO}#{B}██ ██#{CL} #{BO}#{P}██████ #{CL} #{BO}#{C} █████████#{CL}
#{R} ██ ████#{CL} #{G}██ ████#{CL}#{Y} ████ #{CL} #{B}████ ██#{CL} #{P}████ #{CL} #{C}█████ #{CL}
#{R} ██ ██#{CL} #{G}██████ #{CL}#{Y} ████████#{CL} #{B}██████ #{CL} #{P}████████#{CL} #{C}██ #{CL}
EOF
# Credit: http://unix.stackexchange.com/a/41576
echo -e "\n\033[4;31mLight Colors\033[0m \t\t\t \033[1;4;31mDark Colors\033[0m"
echo -e " \e[0;30;47m Black \e[0m 0;30m \t\t \e[1;30;40m Dark Gray \e[0m 1;30m"
echo -e " \e[0;31;47m Red \e[0m 0;31m \t\t \e[1;31;40m Dark Red \e[0m 1;31m"
echo -e " \e[0;32;47m Green \e[0m 0;32m \t\t \e[1;32;40m Dark Green \e[0m 1;32m"
echo -e " \e[0;33;47m Brown \e[0m 0;33m \t\t \e[1;33;40m Yellow \e[0m 1;33m"
echo -e " \e[0;34;47m Blue \e[0m 0;34m \t\t \e[1;34;40m Dark Blue \e[0m 1;34m"
echo -e " \e[0;35;47m Magenta \e[0m 0;35m \t\t \e[1;35;40m Dark Magenta\e[0m 1;35m"
echo -e " \e[0;36;47m Cyan \e[0m 0;36m \t\t \e[1;36;40m Dark Cyan \e[0m 1;36m"
echo -e " \e[0;37;47m Light Gray\e[0m 0;37m \t\t \e[1;37;40m White \e[0m 1;37m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment