-
-
Save benizi/4173926 to your computer and use it in GitHub Desktop.
Show how different terminals show bold colors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Print four lines showing blocks of colors: 0-7 | 0-7bold | 8-15 | 8-15bold | |
perl -CADS -lwe ' | |
my $block = shift || (chr(0x2588) x 3); | |
for (["", 0], ["1;", 0], ["", 8], ["1;", 8]) { | |
my ($bold, $offset) = @$_; | |
my @range = map $offset + $_, 0..7; | |
printf "%s %-6s ", $bold ? "bold" : "norm", "$range[0]-$range[-1]"; | |
print map("\e[${bold}38;5;${_}m$block", @range), "\e[0m" | |
} | |
' "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
dir=$0:h | |
for term_array ( | |
'st true' | |
'konsole true' | |
'gnome-terminal false' | |
'Terminal false' | |
'terminal false' | |
'terminator false' | |
'urxvt-256color true -is +is' | |
'uxterm true -bdc +bdc') | |
do | |
opts=( $=term_array ) | |
term=$opts[1] | |
array_args=$opts[2] | |
opts[1,2]=() | |
(( $#opts )) || opts=( '' ) | |
for opt in "${opts[@]}" | |
do | |
shcmd="echo $term $opt ; $dir/simpler ; read" | |
if $array_args | |
then | |
cmd=( sh -c $shcmd ) | |
else | |
cmd=( "sh -c ${(q)shcmd}" ) | |
fi | |
tcmd=( $term $opt -e $cmd ) | |
$tcmd & | |
sleep 0.5 | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Edited to match this SuperUser post