.\" 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 "Chart::Color::Value 3" .TH Chart::Color::Value 3 "2022-09-05" "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" Chart::Color::Value \- check, convert and measure color values .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 5 \& my @names = Chart::Color::Value::all_names(); \& my @rgb = Chart::Color::Value::rgb_from_name(\*(Aqdarkblue\*(Aq); \& my @hsl = Chart::Color::Value::hsl_from_name(\*(Aqdarkblue\*(Aq); \& my @hsl2 = Chart::Color::Value::hsl_from_rgb( 5 ,10, 100); \& my $d = Chart::Color::Value::distance_hsl( \e@hsl, \e@hsl2); \& \& Chart::Color::Value::add_rgb(\*(Aqlucky\*(Aq, [0, 100, 50]); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\s-1RGB\s0 and \s-1HSL\s0 values of named colors from the X11 and \s-1HTML\s0 standard and Pantone report. Allows also reverse search, storage and conversion of color values. .PP This module is supposed to be used by Chart::Color and not directly by the user (for the most part). It converts a stored color name into its values (rgb, hsl or both) and back. One color can have multiple names. Also nearby (similar) colors can be searched. Own colors can be (none permanently) stored for later reference by name. For this a name has to be chosen, that is not already taken. Independently of that can any color be converted from rgb to hsl and back. .SH "ROUTINES" .IX Header "ROUTINES" .SS "check_rgb" .IX Subsection "check_rgb" Return error message if \s-1RGB\s0 value triplet is not valid (in range). .SS "check_hsl" .IX Subsection "check_hsl" Return error message if \s-1HSL\s0 value triplet is not valid (in range). .SS "trim_rgb" .IX Subsection "trim_rgb" Change \s-1RGB\s0 triplet to the nearest valid values. .SS "trim_hsl" .IX Subsection "trim_hsl" Change \s-1HSL\s0 triplet to the nearest valid values. .SS "hsl_from_rgb" .IX Subsection "hsl_from_rgb" Converting an rgb value triplet into the corresponding hsl .PP Red, Green and Blue are integer in 0 .. 255. Hue is an integer between 0 .. 359 (hue) and saturation and lightness are 0 .. 100 (percentage). A hue of 360 and 0 (degree in a cylindrical coordinate system) is considered to be the same, this modul deals only with the ladder. .SS "rgb_from_hsl" .IX Subsection "rgb_from_hsl" Converting an hsl value triplet into the corresponding rgb (see rgb_from_name and hsl_from_name). Please not that back and forth conversion can lead to drifting results due to rounding. .PP .Vb 4 \& my @rgb = Chart::Color::Value::rgb_from_hsl(0, 90, 50); \& my @rgb = Chart::Color::Value::rgb_from_hsl([0, 90, 50]); # works too \& # for real (none integer results), any none zero value works as second arg \& my @rgb = Chart::Color::Value::rgb_from_hsl([0, 90, 50], \*(Aqreal\*(Aq); .Ve .SS "distance_rgb" .IX Subsection "distance_rgb" Distance in (linear) rgb color space between two coordinates. .PP .Vb 1 \& my $d = Chart::Color::Value::distance_rgb([1,1,1], [2,2,2]); # approx 1.7 .Ve .SS "distance_hsl" .IX Subsection "distance_hsl" Distance in (cylindrical) hsl color space between two coordinates. .PP .Vb 1 \& my $d = Chart::Color::Value::distance_rgb([1,1,1], [356, 3, 2]); # approx 6 .Ve .SH "COPYRIGHT & LICENSE" .IX Header "COPYRIGHT & LICENSE" Copyright 2022 Herbert Breunung. .PP This program is free software; you can redistribute it and/or modify it under same terms as Perl itself. .SH "AUTHOR" .IX Header "AUTHOR" Herbert Breunung,