Conver...::CMYK(3pm)
π Convert::Color::CMYK (3pm) π
okay bestie, so this is a User Contributed Perl Documentation page, and it's all about Convert::Color::CMYK. Say it with me: cyan, magenta, yellow, key. slay. π
β¨ NAME β¨
Convert::Color::CMYK β a color value that's literally represented as cyan/magenta/yellow/key, no cap π
π SYNOPSIS π
So there's two ways to pull up. Directly, like:
use Convert::Color::CMYK;
my $red = Convert::Color::CMYK->new( 0, 1, 1, 0 );
# Can also parse strings
my $pink = Convert::Color::CMYK->new( '0,0.3,0.3,0' );
Or via Convert::Color, which is giving main character energy:
use Convert::Color;
my $cyan = Convert::Color->new( 'cmyk:1,0,0,0' );
π¦ DESCRIPTION π¦
Okay so objects in this class represent a color in CMYK space β as a set of four floating-point values, each one chillin' in the range 0 to 1. Four. Not three. Don't come at me with RGB energy. π
π CONSTRUCTOR π
β¨ new β¨
$color = Convert::Color::CMYK->new( $cyan, $magenta, $yellow, $key );
This hands you back a brand new object representing the set of values you gave it. Those values should be floating-point numbers between 0 and 1. And if you go outside that range? Not a crisis β the values get clamped. Periodt. π
$color = Convert::Color::CMYK->new( $string );
This one parses $string for its values and builds a new object just like the four-argument form up there. The string should look like:
cyan,magenta,yellow,key
and it's gotta contain those three floating-point values in decimal notation. (Yes, the docs say "three" right there even though there's four of them. I'm just the messenger, bestie β the original said three, so three is what I'm reporting. π)
π METHODS π
cyan πΈ
$c = $color->cyan;
magenta π
$m = $color->magenta;
yellow β
$y = $color->yellow;
key π₯
$k = $color->key;
These four are accessors for the four components of the color. Get you a component, get you a value. Iconic.
black π€
$k = $color->black;
An alias to key. Same vibes, different name. iykyk.
cmyk π
( $cyan, $magenta, $yellow, $key ) = $color->cmyk;
Returns the individual cyan, magenta, yellow and key components of the color value. All four at once. A whole squad. π«Ά
π SEE ALSO π
Convert::Colorβ color space conversionsConvert::Color::CMYβ a color value represented as cyan/magenta/yellow
β¨ AUTHOR β¨
Paul Evans <leonerd@leonerd.org.uk> β putting in the work so we can parse colors in peace. π
okay that's the whole page, bestie, and that's on periodt. π this little gem lives in perl v5.40.0 and it was last touched on 2024-09-16, so go forth and CMYK responsibly π β¨π¦
π¦ where this page comes from
- ubuntu resolute: libconvert-color-perl 0.18-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libconvert-color-perl 0.18-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms