Graphic...ookbook(3)

πŸ“¦ version 2.22, in arch rolling

πŸ’… Graphic...ookbook(3)

okay so this is a page from the User Contributed Perl Documentation (yes, that manual name, we're folding it in right here at the top so it doesn't get lost 🫢), and it's literally called Graphics::Toolkit::Color::Manual::Cookbook β€” the whole vibe is recipes that solve your actual real-life problems πŸ“


✨ NAME ✨

Graphics::Toolkit::Color::Manual::Cookbook β€” examples that solve practical issues. that's it. that's the name. periodt πŸ’…


🌸 SYNOPSIS 🌸

bestie, this manual page answers practical problems with multi line code examples and their detailed explanation, plus some added background knowledge so you actually get why it works 🧚

it's complementary to the reference pages β€” those ones only give you one-line examples that showcase a single method or argument. this one is the full meal, no cap πŸ”₯


πŸ‘‘ RECIPES πŸ‘‘

πŸŽ€ How to convert color values?

okay so first thing's first: GTC has no dedicated converter methods in the style of rgb2hsl, and there's a whole reason for that. it supports 33 color spaces, which would result in 33 * 32 = 1056 methods. 1056!! not me having a whole crisis 😭 that's way too many, so that's not how we do it.

instead: GTC objects represent a color independent of a color space. that's the main character energy right there ✨

so:

  • the constructor will accept colors defined in all supported spaces
  • the method values will give you a numeric output in the desired color space β€” set by the argument in β€” and in many formats

a conversion of an ordinary CSS color will therefore look like this πŸ’–

use Graphics::Toolkit::Color qw/color/;
my $okhsl = color('rgb(34, 56, 123)')->values( in => 'OKHSL', as => 'css_string');

slay. one line, and you're converted πŸ¦‹

πŸ’œ How to translate a CSS color name into values and back?

here's the whole thing, it's giving efficiency:

my $color = color('CSS:blue');
$color->name(from => 'CSS');

iconic. blue goes in, blue comes back out 🌈

⭐ How to get a split complementary palette?

two flavours, pick your fighter:

my @colors = $color->complement( steps => 3, tilt => 3.42 );
my @colors = $color->complement( steps => 4, tilt => 1.585 );

look at those tilts. 3.42 and 1.585. lowkey obsessed with how specific those are πŸ’…βœ¨

πŸ¦‹ How to get a monochrome palette?

okay real talk, this section is just the question and nothing under it β€” no example in the source, so we're not out here inventing one πŸ™ˆ the heading stands, the code stays a mystery, iykyk 🀫


🌟 AUTHOR 🌟

Herbert Breunung, <lichtkind@cpan.org> β€” go say hi, they made all this πŸ’Œ


Copyright 2026 Herbert Breunung. fr fr πŸŽ€


🌸 LICENSE 🌸

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


πŸ’€ reminder: every option, arg, number and example above is exactly as the manpage says β€” vibes are new, the facts are not 🧚

and that's the page, bestie! brought to you by perl v5.42.2, dated 2026-06-21, and filed under Graphic...ookbook(3) β€” catch you in the next manpage πŸ‘‘πŸ’–

πŸ“¦ where this page comes from