Skip to content

Instantly share code, notes, and snippets.

View pborenstein's full-sized avatar

Philip Borenstein pborenstein

View GitHub Profile
@pborenstein
pborenstein / Colorfn Notes.txt
Last active August 29, 2015 14:05
Color functions
From: http://misc.flogisoft.com/bash/tip_colors_and_formatting
This is working for me for now (it's only lightly tested, fails gracefully if the numbers are too high, fails ungracefully if you give too few arguments, and uses features in bash new to me (hey, been away for awhile), so not sure if they are standard or new... with that out of the way:
Now I can do things like echo "$(c_grey 15)I'm light Grey$(c_clr)" and
echo "$(cb_rgb 5 0 0)Red$(cb_rgb 0 5 0)Green$(cb_rgb 0 0 5)Blue$(c_clr)"
At any rate, hope this helps someone.
@pborenstein
pborenstein / colorsxterm.sh
Created August 10, 2014 03:49
Print all the xterm colors
#! /usr/bin/env bash
# print all the xterm colors
# see http://serverfault.com/a/91873 about caculating the rgb values
for c in {0..15}
do
printf "\033[38;5;%dm %2d" $c $c
if (( (c+1) % 8 == 0 )) ; then