summaryrefslogtreecommitdiff
path: root/test-nick-colors
blob: a09f74a1b9e28abb58f2e3c9f06af272061b696f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
# Check whether the terminal colours filtered by our algorithm are legible
export example=$(
	tcc "-run -lm" - <<-EOF
	#include <stddef.h>
	#include <stdio.h>
	#include <math.h>

	$(perl -0777 -ne 'print $& if /^.*?\nfilter_color(?s:.*?)^}$/m' degesch.c)

	void main () {
		size_t len = 0;
		int *table = filter_color_cube_for_acceptable_nick_colors (&len);
		for (size_t i = 0; i < len; i++)
			printf ("<@\\x1b[38;5;%dmIRCuser\\x1b[m> I'm typing!\n", table[i]);
	}
	EOF
)

# Both should give acceptable results,
# which results in a bad compromise that the main author himself needs
xterm -bg black -fg white -e 'echo $example; cat' &
xterm -bg white -fg black -e 'echo $example; cat' &