Generates a monochromatic constrasting colour palette for background and foreground. What does this mean?
Monochromatic: A single colour is used to generate the base palette, and this colour is lightened five times and darkened five times to provide eleven distinct colours.
Contrasting: The foreground is also generated as a monochromatic colour palettte; however, all generated colours are tested to see that they are appropriately contrasting to ensure maximum readability of the foreground against the background.
| Constants | |
|---|---|
| DEFAULT_ |
|
| DEFAULT_ |
|
| Public Attributes | |
|---|---|
| background | Hash of CSS background colour values. |
| foreground | Hash of CSS foreground colour values. |
| minimum_ |
The minimum brightness difference between the background and the foreground, and must be between 0..1. Setting this value will regenerate the palette based on the base colours. The default value for this is 125 / 255.0. If this value is set to nil, it will be restored to the default. |
| minimum_ |
The minimum colour difference between the background and the foreground, and must be between 0..3. Setting this value will regenerate the palette based on the base colours. The default value for this is 500 / 255.0. |
| Public Methods | |
|---|---|
| brightness_ |
Returns the absolute difference between the brightness levels of two colours. This will be a decimal value between 0 and 1. W3C accessibility guidelines for colour contrast suggest that this value be at least approximately 0.49 (125 / 255.0) for proper contrast. |
| calculate_ |
Given a background colour and a foreground colour, modifies the foreground colour so that it will have enough contrast to be seen against the background colour. |
| color_ |
Returns the contrast between to colours, a decimal value between 0 and |
| minimum_ |
|
| minimum_ |
|
| new | Generate the initial palette. |
| regenerate | Generate the colour palettes. |
<code/>and<pre/>for code samples.