Graphics::Toolkit::Color::Manual::Cookbook(3pm)

Graphics::Toolkit::Color::Manual::Cookbook3pm

Examples that solve practical issues

Usage

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, <[email protected]>

License

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

From perl-graphics-toolkit-color 2.22-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.