codeworld-base-0.2.0.0: Replacement base module for CodeWorld

Safe HaskellNone
LanguageHaskell98

Extras.Colors

Description

Convenience functions for specifying colors by name, hexadecimal value, integer value between 0 and 255, and a few other ways.

Synopsis

Documentation

Extra Colors

To use the extra features in this module, you must begin your code with this line:

import Extras.Colors

painted :: (Picture, Text) -> Picture #

The given picture painted with the color corresponding to the given color name, which must be a valid argument of the colorNamed function.

colorNamed :: Text -> Color #

Convert the name of a color to the actual color. The name of the color can be specified in two ways. First, you can use the official CSS color, as defined in the working document CSS Color Module Level 4, which can be found at https://drafts.csswg.org/css-color/#named-colors. You can also specify the color as a Text with the pattern "#xxxxxx", where the first character is a hash tag and the rest are 6 hexadecimal digits that correspond to the hex color, as usually defined in HTML documents.

The list of named colors is:

aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgreen, darkgrey, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, green, greenyellow, grey, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgreen, lightgrey, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, rebeccapurple, red, rosybrown, royalblue, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, and yellowgreen.

rgb :: (Number, Number, Number) -> Color #

This function allows you to specify color components in the range 0 to 255 instead of 0 to 1.

greyed :: Number -> Color #

A shade of grey as given by the argument, where greyed(0) is black and greyed(1) is white.

withAlpha :: (Color, Number) -> Color #

This function allows you to specify the level of transparency of the given color. Transparency must be given in the range 0 (fully transparent) to 1 (fully opaque).