colortable(3)
NAME
RTF::ColorTable - Class for generating RTF document color
tables
DESCRIPTION
RTF::ColorTable is an RTF::Group which generates color
tables for RTF documents.
SYNOPSIS
use RTF::ColorTable;
my $gColorTable = RTF::ColorTable->new();
my $cBlack = $gColorTable->add_color(0, 0, 0);
if (my $cBlue = $gColorTable->find_color(0, 0, 255))
{
print "Blue is defined";
}
print $gColorTable->count(), " colors defined.";
unless ($gColorTable->is_valid( $cBlack ))
{
die "Invalid color";
}
my $cDefault = $gColorTable->auto_color();
METHODS
RTF::ColorTable is a RTF::Group. The following methods
have been added:
- add_color
- $color = $obj->add_color( $red, $green, $blue );
- Adds the color specified by $red, $green, and $blue to the
color table, and returns the color code. If the color is
already in the table, it turns the color code of that
color. - Color names are not supported in this version. If you
named colors, you can get them from "Graphics::Color
Names". - This is an alias for the "add_rgb" method (which is depre
cated). - find_color
if ($color = $obj->find_color( $red, $green, $blue ) )- ...
- Returns the specified color, if it exists. Otherwise it
returns "undef". - This is an alias for the "find_rgb" method (which is dep
recated). - auto_color
$cDefault = $obj->auto_color();- Returns the default color (also known as the "auto
color"). This is a special color code used in RTF docu
ments. - This is an alias for the "get_default" method.
- Generally the auto-color is left undefined, and when it is
set, most RTF readers either ignore it or confuse it with
the first color. So there is no method to set the default
color. - is_valid
if ($obj->is_valid( $color )) ...- Returns true is the color is valid (that is, it has been
added to the color table, or it is the auto color). - count
$num_colors = $obj->count();- Returns the number of colors in the table. Because of the
auto color, there is always at least one color defined.
SEE ALSO
Microsoft Technical Support and Application Note, "Rich
Text Format (RTF) Specification and Sample Reader Pro
gram", Version 1.5.
AUTHOR
Robert Rothenberg <rrwo@cpan.org>
LICENSE
- Copyright (c) 2000-2001 Robert Rothenberg. All rights
reserved. This program is free software; you can redis
tribute it and/or modify it under the same terms as Perl
itself.