From 03929dac2a29664878d2c971648a4fe1fb698462 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 22:19:02 +0200 Subject: Adding upstream version 20231031. Signed-off-by: Daniel Baumann --- scripts/cubes.pl | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 scripts/cubes.pl (limited to 'scripts/cubes.pl') diff --git a/scripts/cubes.pl b/scripts/cubes.pl new file mode 100644 index 0000000..58d0c71 --- /dev/null +++ b/scripts/cubes.pl @@ -0,0 +1,55 @@ +use strict; +use warnings; +use Irssi 20140603; + +our $VERSION = '1.1'; +our %IRSSI = ( + authors => 'Irssi staff', + contact => 'staff@irssi.org', + url => 'https://irssi.org', + name => 'cubes', + description => '256 colour test script for Irssi.', + license => 'Public Domain', +); + +sub cubes { + my $t = $_[0]; + my $w = Irssi::active_win; + my $C = MSGLEVEL_CLIENTCRAP; + my $N = MSGLEVEL_NEVER | $C; + my $T = $t ? "X" : "x"; + my $M = $t ? "" : "99,"; + my $P = sub { + $w->print(@_) + }; + $P->("%_bases", $C); + $P->( do { + join '', map { "%${T}0${_}0$_" } '0' .. '9', 'A' .. 'F' + }, $N); + $P->("%_cubes", $C); + $P->( do { + my $y = $_*6; + join '', map { + my $x = $_; + map { "%${T}$x$_$x$_" } @{['0' .. '9', 'A' .. 'Z']}[$y .. $y+5] + } 1 .. 6 + }, $N) + for 0 .. 5; + $P->("%_grays", $C); + $P->( do { + join '', map { "%${T}7${_}7$_" } 'A' .. 'X' + }, $N); + $P->("%_mIRC extended colours", $C); + my $x; + $x .= sprintf "\cC$M%02d%02d", $_, $_ + for 0 .. 15; + $P->($x, $N); + for my $z (0 .. 6) { + my $x; + $x .= sprintf "\cC$M%02d%02d", $_, $_ + for 16 + ($z * 12) .. 16 + ($z * 12) + 11; + $P->($x, $N); + } +} +Irssi::command_bind 'cubes' => sub { cubes(0); }; +Irssi::command_bind 'cubes_text' => sub { cubes(1); }; -- cgit v1.2.3