Graphic...ookbook(3)
π 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
valueswill give you a numeric output in the desired color space β set by the argumentinβ 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 π«Ά
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
- arch rolling: perl-graphics-toolkit-color 2.22-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms