-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathshow_acedb_colors
executable file
·64 lines (47 loc) · 1.38 KB
/
show_acedb_colors
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env perl
use strict;
use warnings;
### show_acedb_colors
use CanvasWindow;
use Hum::Ace::Colors;
{
my $mw = CanvasWindow::MainWindow->new;
$mw->title('acedb colors');
my $cw = CanvasWindow->new($mw);
my $canvas = $cw->canvas;
my $size = 15;
my $pad = $size / 2;
my @color_name = Hum::Ace::Colors::list_all_color_names_by_value();
my $font = ['Helvetica', $size, 'normal'];
for (my $i = 0; $i < @color_name; $i++) {
my $name = $color_name[$i];
my $hex = Hum::Ace::Colors::acename_to_webhex($name);
warn "$name = $hex\n";
my $x1 = $size;
my $x2 = $x1 + $size;
my $y1 = $size + (($size + $pad) * $i);
my $y2 = $y1 + $size;
$canvas->createRectangle(
$x1, $y1, $x2, $y2,
-fill => undef,
-outline => $hex,
);
$canvas->createRectangle(
$x2 + $pad, $y1, $x2 + $pad + $size, $y2,
-fill => $hex,
-outline => 'black',
);
$canvas->createText(
$x2 + $size + $size, $y1,
-text => $name,
-anchor => 'nw',
-font => $font,
);
}
$cw->fix_window_min_max_sizes;
Tk::MainLoop();
}
__END__
=head1 NAME - show_acedb_colors
=head1 AUTHOR
James Gilbert B<email> [email protected]