.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Color::Palette 3pm" .TH Color::Palette 3pm "2023-01-08" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Color::Palette \- a set of named colors .SH "VERSION" .IX Header "VERSION" version 0.100004 .SH "DESCRIPTION" .IX Header "DESCRIPTION" The libraries in the Color-Palette distribution are meant to make it easy to build sets of named colors, and to write applications that can define and validate the color names they required. .PP For example, a color palette might contain the following data: .PP .Vb 5 \& highlights => #f0f000 \& background => #333 \& sidebarBackground => #88d \& sidebarText => \*(Aqhighlights\*(Aq \& sidebarBoder => \*(AqsidebarText\*(Aq .Ve .PP Colors can be defined by a color specifier (a Graphics::Color object, a CSS-style hex triple, or an arrayref of \s-1RGB\s0 values) or by a name of another color that appears in the palette. If colors are defined in terms of another color that doesn't exist, an exception will be raised. .PP Applications that wish to use color palettes can provide schemas that define the names they expect to be present in a palette. These schemas are Color::Palette::Schema objects. .PP A palette can be checked against a schema with the schema's \f(CW\*(C`check\*(C'\fR method, or may be reduced to the minimal set of colors needed to satisfy the schema with the palette's \f(CW\*(C`optimized_for\*(C'\fR method. .SH "PERL VERSION" .IX Header "PERL VERSION" This library should run on perls released even a long time ago. It should work on any version of perl released in the last five years. .PP Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl. .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" .SS "colors" .IX Subsection "colors" This attribute is a hashref. Keys are color names and values are either Color objects or names of other colors. To get at the color object for a name consult the \f(CW"color"\fR method. .SH "METHODS" .IX Header "METHODS" .SS "color" .IX Subsection "color" .Vb 1 \& my $color_obj = $palette\->color(\*(AqextremeHighlight\*(Aq); .Ve .PP This method will return the Color object to be used for the given name. .SS "color_names" .IX Subsection "color_names" .Vb 1 \& my @names = $palette\->color_names; .Ve .PP This method returns a list of all color names the object knows about. .SS "as_css_hash" .IX Subsection "as_css_hash" .Vb 1 \& my $triple_for = $palette\->as_css_hash .Ve .PP This method returns a hashref. Every color name known to the palette has an entry, and the value is the CSS-safe hex string for the resolved color. For example, the output for the color scheme in the \*(L"\s-1DESCRIPTION\*(R"\s0 section would be: .PP .Vb 7 \& { \& highlights => \*(Aq#f0f000\*(Aq, \& background => \*(Aq#333333\*(Aq, \& sidebarBackground => #8888dd\*(Aq, \& sidebarText => #f0f000\*(Aq, \& sidebarBoder => #f0f000\*(Aq, \& } .Ve .SS "as_strict_css_hash" .IX Subsection "as_strict_css_hash" .Vb 1 \& my $hashref = $palette\->as_strict_css_hash; .Ve .PP This method behaves just like \f(CW"as_css_hash"\fR, but the returned hashref is tied so that trying to read values for keys that do not exist is fatal. The hash may also become read-only in the future. .SS "optimized_for" .IX Subsection "optimized_for" .Vb 1 \& my $optimized_palette = $palette\->optimized_for($schema); .Ve .PP This method returns a new palette containing only the colors needed to fulfill the requirements of the given schema. This is useful for reducing a large palette to the small set that must be embedded in a document. .PP \&\f(CW\*(C`optimize_for\*(C'\fR redispatches to this method for historical reasons. .SH "AUTHOR" .IX Header "AUTHOR" Ricardo \s-1SIGNES\s0 .SH "CONTRIBUTORS" .IX Header "CONTRIBUTORS" .IP "\(bu" 4 Karen Etheridge .IP "\(bu" 4 Ricardo Signes .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2022 by Ricardo \s-1SIGNES.\s0 .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.