Color::Scheme - generate pleasant color schemes
use Color::Scheme; my $scheme = Color::Scheme->new ->from_hex('ff0000') # or ->from_hue(0) ->scheme('analog') ->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" ] ]
This module is a Perl implementation of Color Schemes 2 (http://wellstyled.com/tools/colorscheme2/), a color scheme generator. Start by visitng the Color Schemes 2 web site and playing with the colors. When you want to generate those schemes on the fly, begin using this modoule. The descriptions herein don't make too much sense without actually seeing the colorful results.
Henceforth, paragraphs in quotes denote documentation copied from Color Schemes 2.
"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."
new method will return a new
Returns an array of 4, 8, 12 or 16 colors in
RRGGBB hexidecimal 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.
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".
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 isntead 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.
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); my $second_background = ($scheme->colors);
Or, with this method,
my $first_background = $scheme->colorset->; my $second_background = $scheme->colorset->;
Sets the base color hue, where
degrees is an integer. (Values greater than 359 and less than 0 wrap back around the wheel.)
The default base hue is 0, or bright red.
Sets the base color to the given color, where
color is in the hexidecimal form RRGGBB.
color should not be preceeded with a hash (#).
The default base color is the equivalent of #ff0000, or bright red.
If BOOLEAN is true, an extra set of colors will be produced using the complement of the selected color.
This only works with the analogic color scheme. The default is false.
The default is false.
The default is 0.5.
name must be a valid color variation name. See "COLOR VARIATIONS".
The following documentation is adapated (and mostly copied verbatim) from the Color Schemes 2 help. Use one of these scheme names as an argument to the "scheme()" method.
"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."
"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."
"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."
"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."
"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."
"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.
The default preset. Generally pretty nice.
Softer colors with added whiteness.
Darker pastel colors.
Very light, almost washed-out colors.
Deeper, more-saturated colors.
Greyer, less-saturated colors.
This Per; module was created by Ian Langworth <email@example.com>
Copyright (C) 2005 Ian Langworth
This license has been granted explictly by the author of Color Schemes 2. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.