From 378a0a9f7041d0f886ff7639c55f9ac4dd5796ca Mon Sep 17 00:00:00 2001 From: hjp Date: Tue, 5 Jul 2016 19:30:30 +0000 Subject: [PATCH] print color table for 256 color xterm --- xterm256colortable/xterm256colortable | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 xterm256colortable/xterm256colortable diff --git a/xterm256colortable/xterm256colortable b/xterm256colortable/xterm256colortable new file mode 100755 index 0000000..f4ba138 --- /dev/null +++ b/xterm256colortable/xterm256colortable @@ -0,0 +1,19 @@ +#!/usr/bin/perl + +for my $i (0 .. 255) { + print fg(0), bg(15), sprintf("%3d", $i), " : ", bg($i), "x" x 10, rst(), "\n"; +} + + +sub fg { + my ($idx) = @_; + return "\033[38;5;${idx}m"; +} + +sub bg { + my ($idx) = @_; + return "\033[48;5;${idx}m"; +} +sub rst { + return "\033[0m"; +}