File: colors.sl

package info (click to toggle)
slxfig 0.2.0~.138-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,196 kB
  • sloc: sh: 3,086; ansic: 598; makefile: 265; php: 6
file content (20 lines) | stat: -rw-r--r-- 502 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require ("xfig");

public define slsh_main ()
{
   variable color, ncolors = 33;
   variable w = xfig_plot_new (14, 20);
   w.world (0, 1, ncolors, -1);
   w.xaxis(; major=[-1, 2]);
   _for color (0, ncolors-1, 1)
     {
	w.plot ([0.1, 0.5], [color, color]; width=6, color=color);
	variable info = xfig_get_color_info (color);
	if (info == NULL)
	  continue;
	w.xylabel (0.6, color,
		   sprintf (`\verb|#%06X %3d  %s|`, info.rgb, color, info.name),
		   -0.5, 0);
     }
   w.render ("colors.png");
}