X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/8b8c77dbf30f70a1e8ade679a62f08e130f959a2..4f444f02fce7e747c016158000f01f63c1c39039:/termcol.plp diff --git a/termcol.plp b/termcol.plp index 446b9c5..a040eed 100644 --- a/termcol.plp +++ b/termcol.plp @@ -1,111 +1,174 @@ -<: -use utf8; -use strict; -use warnings; -use open IO => ':utf8'; -use List::Util 'min'; +<(common.inc.plp)><: + +Html({ + title => 'terminal colour cheat sheet', + version => '1.0', + description => [ + "Index of all terminal/console colour codes,", + "with an example result of various environments.", + ], + keywords => [qw' + color code terminal console escape table xterm rxvt + '], + data => ['termcol.inc.pl'], + stylesheet => [qw'light dark'], +}); + +:> +

Terminal colours

-our $VERSION = 'v1.0'; +

+ANSI (VT100, ISO-6429) 16-colour text palette +as implemented by various systems and programs. +<: +print + !exists $get{v} ? 'Also see 8-bit legacy hardware palettes.' : + 'Also included are 8-bit legacy hardware palettes.'; +:> +

-$header{content_type} = 'text/html; charset=utf-8'; +
+<: +use Shiar_Sheet::Colour '1.03'; +use List::Util qw( min max ); -:> - +my $palettes = do 'termcol.inc.pl'; +die "Cannot open palette data: $_\n" for $@ || $! || (); - -terminal colour cheat sheet - - - +sub colcell { + my $name = shift // return "\n"; + my $col = Shiar_Sheet::Colour->new(@_); + my $minhex = $col->rgb24; + my $css = '#' . $col->rgb48; + my $inverse = '#' . sprintf('%X', $col->luminance/255 < .3 ? 12 : 0) x 3; - -

Terminal colours

+ my $sample = [ qw(#000 #FFF) ]; + ($name, $sample) = @$name if ref $name eq 'ARRAY'; - -
-

88-colour space

+:>
+