| Graphics::Toolkit::Color::Manual::Cookbook(3) | User Contributed Perl Documentation | Graphics::Toolkit::Color::Manual::Cookbook(3) |
NAME
Graphics::Toolkit::Color::Manual::Cookbook - examples that solve practical issues
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.
RECIPES
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:
use Graphics::Toolkit::Color qw/color/;
my $okhsl = color('rgb(34, 56, 123)')->values( in => 'OKHSL', as => 'css_string');
How to translate a CSS color name into values and back?
my $color = color('CSS:blue');
$color->name(from => 'CSS');
How to get a split complementary palette?
my @colors = $color->complement( steps => 3, tilt => 3.42 ); my @colors = $color->complement( steps => 4, tilt => 1.585 );
How to get a monochrome palette?
AUTHOR
Herbert Breunung, <lichtkind@cpan.org>
COPYRIGHT
Copyright 2026 Herbert Breunung.
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| 2026-06-20 | perl v5.42.2 |