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 conversions
  • Convert::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