.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45) .\" .\" 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 .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . 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 .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "Graphics::Toolkit::Color::Manual::Cookbook 3" .TH Graphics::Toolkit::Color::Manual::Cookbook 3 2026-06-20 "perl v5.42.2" "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 Graphics::Toolkit::Color::Manual::Cookbook \- examples that solve practical issues .SH SYNOPSIS .IX Header "SYNOPSIS" This manual page answers practical problems with multi line code examples and their detailed explanation with some added background knowledge. This is complementary to the reference pages that contain only one line examples that showcase a single method or argument. .SH RECIPES .IX Header "RECIPES" .SS "How to convert color values?" .IX Subsection "How to convert color values?" GTC has no dedicated converter methods in the style of rgb2hsl because it supports 33 color spaces, which would result in 33 * 32 = 1056 methods. GTC objects represent a color independent of a color space. That is why the constructor will accept colors defined in all supported spaces and the method values will give you a numeric output in the desired color space set by the argument in and many formats. A conversion of an ordinary CSS color will therefore look like: .PP .Vb 2 \& use Graphics::Toolkit::Color qw/color/; \& my $okhsl = color(\*(Aqrgb(34, 56, 123)\*(Aq)\->values( in => \*(AqOKHSL\*(Aq, as => \*(Aqcss_string\*(Aq); .Ve .SS "How to translate a CSS color name into values and back?" .IX Subsection "How to translate a CSS color name into values and back?" .Vb 2 \& my $color = color(\*(AqCSS:blue\*(Aq); \& $color\->name(from => \*(AqCSS\*(Aq); .Ve .SS "How to get a split complementary palette?" .IX Subsection "How to get a split complementary palette?" .Vb 2 \& my @colors = $color\->complement( steps => 3, tilt => 3.42 ); \& my @colors = $color\->complement( steps => 4, tilt => 1.585 ); .Ve .SS "How to get a monochrome palette?" .IX Subsection "How to get a monochrome palette?" .SH AUTHOR .IX Header "AUTHOR" Herbert Breunung, .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright 2026 Herbert Breunung. .SH LICENSE .IX Header "LICENSE" This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.