summaryrefslogtreecommitdiffstats
path: root/scripts/cubes.pl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 20:19:02 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 20:19:02 +0000
commit03929dac2a29664878d2c971648a4fe1fb698462 (patch)
tree02c5e2b3e006234aa29545f7a93a1ce01b291a8b /scripts/cubes.pl
parentInitial commit. (diff)
downloadirssi-scripts-upstream.tar.xz
irssi-scripts-upstream.zip
Adding upstream version 20231031.upstream/20231031upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/cubes.pl')
-rw-r--r--scripts/cubes.pl55
1 files changed, 55 insertions, 0 deletions
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); };