Color::Scheme(3pm)
π NAME π
Color::Scheme β the module that generates pleasant color schemes for you, bestie. It's a Perl thing, it's a vibe generator, and yes it's literally about making pretty palettes. π¨β¨
πΈ VERSION πΈ
This is version 1.08, okay? Locked in. π
β¨ SYNOPSIS β¨
Okay so this is how you actually use it, no cap:
use Color::Scheme;
my $scheme = Color::Scheme->new
->from_hex('ff0000') # or ->from_hue(0)
->scheme('analogic')
->distance(0.3)
->add_complement(1)
->variation('pastel')
->web_safe(1)
my @list = $scheme->colors();
# @list = ( "999999","666699","ffffff","99cccc",
# "999999","666699","ffffff","9999cc",
# "669999","666699","ffffff","99cccc",
# "cccccc","996666","ffffff","cccc99" )
my $set = $scheme->colorset();
# $set = [ [ "999999","666699","ffffff","99cccc", ],
# [ "999999","666699","ffffff","9999cc", ],
# [ "669999","666699","ffffff","99cccc", ],
# [ "cccccc","996666","ffffff","cccc99" ] ]
Likeβ¦ chain it, call it, get colors. The way that ->colors() just hands you a list and ->colorset() hands you a list of lists?? Obsessed. π¦
π DESCRIPTION π
So this module is a Perl implementation of Color Schemes 2 (<http://wellstyled.com/tools/colorscheme2/>), which is a color scheme generator. Start by going to the Color Schemes 2 web site and playing with the colors β genuinely, do it, it's fun. Then, when you want to generate those schemes on the fly (not me doing it by hand π), start using this module. The descriptions in here don't make too much sense without actually seeing the colorful results, fr fr.
From here on, any paragraph in quotes is documentation copied from Color Schemes 2. Not mine, theirs. Giving credit where it's due. π
"Important note: This tool doesn't use the standard HSV or HSB model (the same HSV/HSB values ie. in Photoshop describe different colors!). The color wheel used here differs from the RGB spectre used on computer screens, it's more in accordance with the classical color theory. This is also why some colors (especially shades of blue) make less bright shades than the basic colors of the RGB-model. In plus, the RGB-model uses red-green-blue as primary colors, but the red-yellow-blue combination is used here. This deformation also causes incompatibility in color conversions from RGB-values. Therefore, the RGB input (eg. the HTML hex values like #F854A9) is not exact, the conversion is rough and sometimes may produce slightly different color."
π§ PERL VERSION π§
This library should run on perls released even a long time ago. It should work on any version of perl released in the last five years. Slay, backwards compatibility. π
Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl. So like⦠don't come for them if it bumps, okay? That's the deal.
π METHODS π
π« new
The new method will return a new Color::Scheme object. Fresh out the box. New object energy. β¨
π« colors
Returns an array of 4, 8, 12 or 16 colors in RRGGBB hexadecimal notation (without a leading #) depending on the color scheme and addComplement parameter. For each set of four, the first is usually the most saturated color, the second a darkened version, the third a pale version and fourth a less-pale version. It's giving gradient family. π
For example: With a contrast scheme, colors() would return eight colors. Indexes 1 and 5 could be background colors, 2 and 6 could be foreground colors.
Trust me, it's much better if you check out the Color Scheme web site, whose URL is listed in in DESCRIPTION. (Yes, that's two "in"s, I'm just the messenger π β go look at the pretty colors.)
π« colorset
Returns a list of lists of the colors in groups of four. This method simply allows you to reference a color in the scheme by its group instead of its absolute index in the list of colors. I am assuming that colorset() will make it easier to use this module with the templating systems that are out there. Grouped, organized, main character energy. π
For example, if you were to follow the synopsis, say you wanted to retrieve the two darkest colors from the first two groups of the scheme, which is typically the second color in the group. You could retrieve them with colors():
my $first_background = ($scheme->colors)[1];
my $second_background = ($scheme->colors)[5];
Or, with this method,
my $first_background = $scheme->colorset->[0][1];
my $second_background = $scheme->colorset->[1][1];
Same colors, way less math. Periodt. π«Ά
π« from_hue
$scheme->from_hue( $degrees )
Sets the base color hue, where degrees is an integer. (Values greater than 359 and less than 0 wrap back around the wheel β it just loops, cute.)
The default base hue is 0, or bright red. π₯
π« from_hex
$scheme->from_hex( $color )
Sets the base color to the given color, where color is in the hexadecimal form RRGGBB. color should not be preceded with a hash (#). No hash. None. Leave the # at home. π«
The default base color is the equivalent of #ff0000, or bright red. Same energy as the default hue, iconic. π΄
π« add_complement
$scheme->add_complement( $bool )
If $bool is true, an extra set of colors will be produced using the complement of the selected color. Extra colors?? Yes bestie, bonus round. π
This only works with the analogic color scheme. The default is false.
π« web_safe
$scheme->web_safe( $bool )
Sets whether the colors returned by colors() or colorset() will be web-safe.
The default is false.
π« distance
$scheme->distance( $float )
$float must be a value from 0 to 1. You might use this with the triade, tetrade or analogic color schemes. Like a little slider for how spread out everything is. ποΈ
The default is 0.5.
π« scheme
$scheme->scheme( $name )
$name must be a valid color scheme name. See COLOR SCHEMES. The default is mono.
π« variation
$scheme->variation( $name )
$name must be a valid color variation name. See COLOR VARIATIONS. That's it, that's the method. Go pick a vibe. πΈ
π COLOR SCHEMES π
The following documentation is adapted (and mostly copied verbatim) from the Color Schemes 2 help. Use one of these scheme names as an argument to the scheme() method. Pick your fighter. π
π¦ monochromatic (or mono)
"Monochormatic scheme is based on only one color tint, and uses only variations made by changing its saturation and brightness. Black and white colors are always added. The result is comfortable for eyes, even when using aggressive color. However, it's harder to find accents and highlights.
"The application makes only several monochromatic variants of each color. You'll be able to make others - more or less saturated, lighter or darker. Monochromatic variations are made for each color in other schemes, too."
One hue, infinite moods. Lowkey the chill one. π
π¦ contrast
"Base color is supplemented with its complement (color on the opposite side of the wheel). One warm and one cold color is always created - we have to consider, which one will be dominant, and if the result should look warm, or cold. Suitable monochromatic variations of this two colors may be added to the scheme."
Opposites attract, literally. π₯π§
π¦ triade
"Base color is supplemented with two colors, placed identically on both sides of its complement. Unlike the 'sharp' contrast, this scheme is often more comfortable for the eyes, it's softer, and has more space for balancing warm and cold colors.
"You can use the distance() method to set the distance of these colors from the base color complement. The less the value is, the closer the colors are to the contrast color, and are more similar. The best value is between 0.25 and 0.5. Higher values aren't too suitable - except the shift by 60Β°, which makes another color scheme, the triade:
"The triade is made by three colors evenly distributed on the thirds of the color wheel (by 120 degrees). The triade-schemes are vibrating, full of energy, and have large space to make contrasts, accents and to balance warm and cold colors. You can make the triade in the 'soft contrast' scheme setting the distance to the maximal value, 1."
Vibrating, full of energy β it's giving main character palette. β¨
π¦ tetrade
"This scheme, also known as 'double-contrast,' is made by a pair of colors and their complements. It's based on the tetrade - the foursome of colors evenly distributed on the fourths of the color wheel (by 90 degreees). The tetrade is very aggressive color scheme, requiring very good planning and very sensitive approach to relations of these colors.
"Less distance between two base colors causes less tension in the result. However, this scheme is always more 'nervous' and 'action' than other schemes. While working with it, we have to take care especially of relations between one color and the complement of its adjacent color - in case of the tetrade (maximum distance 1), good feeling and very sensitive approach are necessary."
Bestie, this one is A LOT. Handle with care, fr. π
π¦ analogic
"This scheme is made by base color and its adjacent colors - two colors identically on both sides. It always looks very elegantly and clear, the result has less tension and it's uniformly warm, or cold. If a color on the warm-cold border is chosen, the color with opposite 'temperature' may be used for accenting the other two colors.
"You can set the distance of adjacent colors by using distance(). Values between 0.25 and 0.5 (15-30 degrees on the wheel) are optimal. You can also add the contrast color; the scheme is then supplemented with the complement of the base color. It must be treated only as a complement - it adds tension to the palette, and it's too aggressive when overused. However, used in details and as accent of main colors, it can be very effective and elegant."
Elegant, clear, softly iconic. This is the one in the synopsis, iykyk. π«Ά
π¨ COLOR VARIATIONS π¨
"Each of colors in displayed scheme has four variations. These are colors of the same hue, but they differ in the saturation and brightness. ... The very first variation ... is the base variation, which determines the look of the scheme. The other three variations are just additional. Iff the scheme is made by less than four colors, the unused place is used to display variations (or the complement) of the base color."
Use one of these variation names as an argument to the variation() method. Four variations per color, every time. Consistency, slay. π
β default
The default preset. Generally pretty nice.
β pastel
Softer colors with added whiteness. Cloud vibes. βοΈπΈ
β soft
Darker pastel colors.
β light
Very light, almost washed-out colors. Faded denim but make it a palette. π¦
β hard
Deeper, more-saturated colors. Bold. Loud. π₯
β pale
Greyer, less-saturated colors. Muted, moody, artsy. π
π CREDIT π
Color Schemes 2, its documentation and original JavaScript code are copyright pixy <http://www.wellstyled.com/>
The author has explicitly granted license for this distribution of code to be redistribute as specified in the COPYRIGHT AND LICENSE section. So it's all above board, bestie. β
π AUTHOR π
Ian Langworth <ian.langworth@gmail.com>
π«Ά CONTRIBUTORS π«Ά
- Ian Langworth <ian@cpan.org>
- Ricardo Signes <rjbs@cpan.org>
- Ricardo Signes <rjbs@semiotic.systems>
- Yanick Champoux <yanick@babyl.dyndns.org>
Look at them, the whole squad showed up. π
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2005 by Ian Langworth.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Okay bestie that's the whole page, go make something gorgeous with it πβ¨π β this was perl v5.36.0, dated 2023-01-08, and that's the β¨ Color::Scheme(3pm) β¨ era we're living in. Slay, bye! ππ
π¦ where this page comes from
- debian bookworm: libcolor-scheme-perl 1.08-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcolor-scheme-perl 1.08-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcolor-scheme-perl 1.08-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcolor-scheme-perl 1.08-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcolor-scheme-perl 1.08-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