Copyright | (C) 2014-2015, The University of Kansas |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Andy Gill |
Stability | Beta |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
This module exposes overloaded versions of blank-canvas
functions that take a
style or color as an argument, which may be of interest if you desire stronger
type safety than Text
provides.
Note that this module exports function names that conflict with Graphics.Blank. Make sure to hide any functions from Graphics.Blank that you use from this module.
- strokeStyle :: Style style => style -> Canvas ()
- fillStyle :: Style style => style -> Canvas ()
- shadowColor :: CanvasColor canvasColor => canvasColor -> Canvas ()
- addColorStop :: CanvasColor color => (Interval, color) -> CanvasGradient -> Canvas ()
- class Style a where
- class Style a => CanvasColor a
- rgb :: Word8 -> Word8 -> Word8 -> Colour Double
- rgbPercent :: Percentage -> Percentage -> Percentage -> Colour Double
- rgba :: Word8 -> Word8 -> Word8 -> Alpha -> AlphaColour Double
- rgbaPercent :: Percentage -> Percentage -> Percentage -> Alpha -> AlphaColour Double
- hsl :: Degrees -> Percentage -> Percentage -> Colour Double
- hsla :: Degrees -> Percentage -> Percentage -> Alpha -> AlphaColour Double
- data Colour a :: * -> *
- data AlphaColour a :: * -> *
- transparent :: AlphaColour Double
- readColourName :: Monad m => String -> m (Colour Double)
- aqua :: Colour Double
- black :: Colour Double
- blue :: Colour Double
- fuchsia :: Colour Double
- gray :: Colour Double
- green :: Colour Double
- lime :: Colour Double
- maroon :: Colour Double
- navy :: Colour Double
- olive :: Colour Double
- purple :: Colour Double
- red :: Colour Double
- silver :: Colour Double
- teal :: Colour Double
- white :: Colour Double
- yellow :: Colour Double
- orange :: Colour Double
- aliceblue :: Colour Double
- antiquewhite :: Colour Double
- aquamarine :: Colour Double
- azure :: Colour Double
- beige :: Colour Double
- bisque :: Colour Double
- blanchedalmond :: Colour Double
- blueviolet :: Colour Double
- brown :: Colour Double
- burlywood :: Colour Double
- cadetblue :: Colour Double
- chartreuse :: Colour Double
- chocolate :: Colour Double
- coral :: Colour Double
- cornflowerblue :: Colour Double
- cornsilk :: Colour Double
- crimson :: Colour Double
- cyan :: Colour Double
- darkblue :: Colour Double
- darkcyan :: Colour Double
- darkgoldenrod :: Colour Double
- darkgray :: Colour Double
- darkgreen :: Colour Double
- darkgrey :: Colour Double
- darkkhaki :: Colour Double
- darkmagenta :: Colour Double
- darkolivegreen :: Colour Double
- darkorange :: Colour Double
- darkorchid :: Colour Double
- darkred :: Colour Double
- darksalmon :: Colour Double
- darkseagreen :: Colour Double
- darkslateblue :: Colour Double
- darkslategray :: Colour Double
- darkslategrey :: Colour Double
- darkturquoise :: Colour Double
- darkviolet :: Colour Double
- deeppink :: Colour Double
- deepskyblue :: Colour Double
- dimgray :: Colour Double
- dimgrey :: Colour Double
- dodgerblue :: Colour Double
- firebrick :: Colour Double
- floralwhite :: Colour Double
- forestgreen :: Colour Double
- gainsboro :: Colour Double
- ghostwhite :: Colour Double
- gold :: Colour Double
- goldenrod :: Colour Double
- grey :: Colour Double
- greenyellow :: Colour Double
- honeydew :: Colour Double
- hotpink :: Colour Double
- indianred :: Colour Double
- indigo :: Colour Double
- ivory :: Colour Double
- khaki :: Colour Double
- lavender :: Colour Double
- lavenderblush :: Colour Double
- lawngreen :: Colour Double
- lemonchiffon :: Colour Double
- lightblue :: Colour Double
- lightcoral :: Colour Double
- lightcyan :: Colour Double
- lightgoldenrodyellow :: Colour Double
- lightgray :: Colour Double
- lightgreen :: Colour Double
- lightgrey :: Colour Double
- lightpink :: Colour Double
- lightsalmon :: Colour Double
- lightseagreen :: Colour Double
- lightskyblue :: Colour Double
- lightslategray :: Colour Double
- lightslategrey :: Colour Double
- lightsteelblue :: Colour Double
- lightyellow :: Colour Double
- limegreen :: Colour Double
- linen :: Colour Double
- magenta :: Colour Double
- mediumaquamarine :: Colour Double
- mediumblue :: Colour Double
- mediumorchid :: Colour Double
- mediumpurple :: Colour Double
- mediumseagreen :: Colour Double
- mediumslateblue :: Colour Double
- mediumspringgreen :: Colour Double
- mediumturquoise :: Colour Double
- mediumvioletred :: Colour Double
- midnightblue :: Colour Double
- mintcream :: Colour Double
- mistyrose :: Colour Double
- moccasin :: Colour Double
- navajowhite :: Colour Double
- oldlace :: Colour Double
- olivedrab :: Colour Double
- orangered :: Colour Double
- orchid :: Colour Double
- palegoldenrod :: Colour Double
- palegreen :: Colour Double
- paleturquoise :: Colour Double
- palevioletred :: Colour Double
- papayawhip :: Colour Double
- peachpuff :: Colour Double
- peru :: Colour Double
- pink :: Colour Double
- plum :: Colour Double
- powderblue :: Colour Double
- rosybrown :: Colour Double
- royalblue :: Colour Double
- saddlebrown :: Colour Double
- salmon :: Colour Double
- sandybrown :: Colour Double
- seagreen :: Colour Double
- seashell :: Colour Double
- sienna :: Colour Double
- skyblue :: Colour Double
- slateblue :: Colour Double
- slategray :: Colour Double
- slategrey :: Colour Double
- snow :: Colour Double
- springgreen :: Colour Double
- steelblue :: Colour Double
- tan :: Colour Double
- thistle :: Colour Double
- tomato :: Colour Double
- turquoise :: Colour Double
- violet :: Colour Double
- wheat :: Colour Double
- whitesmoke :: Colour Double
- yellowgreen :: Colour Double
- rebeccapurple :: Colour Double
Overloaded versions of Canvas
functions
strokeStyle :: Style style => style -> Canvas () Source
Sets the color, gradient, or pattern used for strokes.
Examples
strokeStyle
red
grd <-createLinearGradient
(0, 0, 10, 10)strokeStyle
grd img <-newImage
"/myImage.jpg" pat <-createPattern
(img,Repeat
)strokeStyle
pat
fillStyle :: Style style => style -> Canvas () Source
Sets the color, gradient, or pattern used to fill a drawing (black
by default).
Examples
fillStyle
red
grd <-createLinearGradient
(0, 0, 10, 10)fillStyle
grd img <-newImage
"/myImage.jpg" pat <-createPattern
(img,Repeat
)fillStyle
pat
shadowColor :: CanvasColor canvasColor => canvasColor -> Canvas () Source
addColorStop :: CanvasColor color => (Interval, color) -> CanvasGradient -> Canvas () Source
Adds a color and stop position in a CanvasGradient
. A stop position is a
number between 0.0 and 1.0 that represents the position between start and stop
in a gradient.
Example
grd <-createLinearGradient
(0, 0, 10, 10) grd #addColorStop
(0,red
)
A data type that can represent a style. That is, something with one or more colors.
class Style a => CanvasColor a Source
A Style
containing exactly one color.
CanvasColor
creation
rgb :: Word8 -> Word8 -> Word8 -> Colour Double Source
Specifies a Colour
by its red, green, and blue components, where each component
is an integer between 0 and 255.
rgbPercent :: Percentage -> Percentage -> Percentage -> Colour Double Source
Specifies a Colour
by its red, green, and blue components, where each component
is given by a percentage (which should be between 0% to 100%) of 255.
rgba :: Word8 -> Word8 -> Word8 -> Alpha -> AlphaColour Double Source
Specifies an AlphaColour
by its RGB components and an alpha value.
rgba
r g b 0.0 =transparent
rgbaPercent :: Percentage -> Percentage -> Percentage -> Alpha -> AlphaColour Double Source
Specifies an AlphaColour
by its RGB component percentages (which should be
between 0% and 100%) and an alpha value.
rgbaPercent
r g b 0.0 =transparent
hsl :: Degrees -> Percentage -> Percentage -> Colour Double Source
Specifies a Colour
by its hue, saturation, and lightness value, where
saturation and lightness are percentages between 0% and 100%.
hsla :: Degrees -> Percentage -> Percentage -> Alpha -> AlphaColour Double Source
Specifies an AlphaColour
by its HSL values and an alpha value.
hsla
h s v 0.0 =transparent
colour
reexports
Colour
and AlphaColour
data Colour a :: * -> *
data AlphaColour a :: * -> *
This type represents a Colour
that may be semi-transparent.
The Monoid
instance allows you to composite colours.
x `mappend` y == x `over` y
To get the (pre-multiplied) colour channel of an AlphaColour
c
,
simply composite c
over black.
c `over` black
AffineSpace AlphaColour | |
ColourOps AlphaColour | |
Eq a => Eq (AlphaColour a) | |
Num a => Monoid (AlphaColour a) |
|
JSArg (AlphaColour Double) Source | |
CanvasColor (AlphaColour Double) Source | |
Style (AlphaColour Double) Source |
transparent :: AlphaColour Double Source
This AlphaColour
is entirely transparent and has no associated
color channel (i.e., rgba(0, 0, 0, 0.0)
or hsla(0, 0%, 0%, 0.0)
).
readColourName :: Monad m => String -> m (Colour Double) Source
Takes a string naming a Colour
(must be all lowercase) and returns it. Fails if
the name is not recognized.
CSS Level 1 colors
CSS Level 2 color
CSS Color Module Level 3 colors
antiquewhite :: Colour Double Source
#FAEBD7
, rgb(250, 235, 215)
, hsl(34, 78%, 91%)
aquamarine :: Colour Double Source
#7FFFD4
, rgb(127, 255, 212)
, hsl(160, 100%, 75%)
blanchedalmond :: Colour Double Source
#FFEBCD
, rgb(255, 235, 205)
, hsl(36, 100%, 90%)
blueviolet :: Colour Double Source
#8A2BE2
, rgb(138, 43, 226)
, hsl(271, 76%, 53%)
chartreuse :: Colour Double Source
#7FFF00
, rgb(127, 255, 0)
, hsl(90, 100%, 50%)
cornflowerblue :: Colour Double Source
#6495ED
, rgb(100, 149, 237)
, hsl(219, 79%, 66%)
darkgoldenrod :: Colour Double Source
#B8860B
, rgb(184, 134, 11)
, hsl(43, 89%, 38%)
darkmagenta :: Colour Double Source
#8B008B
, rgb(139, 0, 139)
, hsl(300, 100%, 27%)
darkolivegreen :: Colour Double Source
#556B2F
, rgb(85, 107, 47)
, hsl(82, 39%, 30%)
darkorange :: Colour Double Source
#FF8C00
, rgb(255, 140, 0)
, hsl(33, 100%, 50%)
darkorchid :: Colour Double Source
#9932CC
, rgb(153, 50, 204)
, hsl(280, 61%, 50%)
darksalmon :: Colour Double Source
#E9967A
, rgb(233, 150, 122)
, hsl(15, 72%, 70%)
darkseagreen :: Colour Double Source
#8FBC8F
, rgb(143, 188, 143)
, hsl(120, 25%, 65%)
darkslateblue :: Colour Double Source
#483D8B
, rgb(72, 61, 139)
, hsl(248, 39%, 39%)
darkslategray :: Colour Double Source
#2F4F4F
, rgb(47, 79, 79)
, hsl(180, 25%, 25%)
. Same as darkslategrey
.
darkslategrey :: Colour Double Source
#2F4F4F
, rgb(47, 79, 79)
, hsl(180, 25%, 25%)
. Same as darkslategray
.
darkturquoise :: Colour Double Source
#00CED1
, rgb(0, 206, 209)
, hsl(181, 100%, 41%)
darkviolet :: Colour Double Source
#9400D3
, rgb(148, 0, 211)
, hsl(282, 100%, 41%)
deepskyblue :: Colour Double Source
#00BFFF
, rgb(0, 191, 255)
, hsl(195, 100%, 50%)
dodgerblue :: Colour Double Source
#1E90FF
, rgb(30, 144, 255)
, hsl(210, 100%, 56%)
floralwhite :: Colour Double Source
#FFFAF0
, rgb(255, 250, 240)
, hsl(40, 100%, 97%)
forestgreen :: Colour Double Source
#228B22
, rgb(34, 139, 34)
, hsl(120, 61%, 34%)
ghostwhite :: Colour Double Source
#F8F8FF
, rgb(248, 248, 255)
, hsl(240, 100%, 99%)
greenyellow :: Colour Double Source
#ADFF2F
, rgb(173, 255, 47)
, hsl(84, 100%, 59%)
lavenderblush :: Colour Double Source
#FFF0F5
, rgb(255, 240, 245)
, hsl(340, 100%, 97%)
lemonchiffon :: Colour Double Source
#FFFACD
, rgb(255, 250, 205)
, hsl(54, 100%, 90%)
lightcoral :: Colour Double Source
#F08080
, rgb(240, 128, 128)
, hsl(0, 79%, 72%)
lightgoldenrodyellow :: Colour Double Source
#FAFAD2
, rgb(250, 250, 210)
, hsl(60, 80%, 90%)
lightgreen :: Colour Double Source
#90EE90
, rgb(144, 238, 144)
, hsl(120, 73%, 75%)
lightsalmon :: Colour Double Source
#FFA07A
, rgb(255, 160, 122)
, hsl(17, 100%, 74%)
lightseagreen :: Colour Double Source
#20B2AA
, rgb(32, 178, 170)
, hsl(177, 70%, 41%)
lightskyblue :: Colour Double Source
#87CEFA
, rgb(135, 206, 250)
, hsl(203, 92%, 75%)
lightslategray :: Colour Double Source
#778899
, rgb(119, 136, 153)
, hsl(210, 14%, 53%)
. Same as lightslategrey
.
lightslategrey :: Colour Double Source
#778899
, rgb(119, 136, 153)
, hsl(210, 14%, 53%)
. Same as lightslategray
.
lightsteelblue :: Colour Double Source
#B0C4DE
, rgb(176, 196, 222)
, hsl(214, 41%, 78%)
lightyellow :: Colour Double Source
#FFFFE0
, rgb(255, 255, 224)
, hsl(60, 100%, 94%)
mediumaquamarine :: Colour Double Source
#66CDAA
, rgb(102, 205, 170)
, hsl(160, 51%, 60%)
mediumblue :: Colour Double Source
#0000CD
, rgb(0, 0, 205)
, hsl(240, 100%, 40%)
mediumorchid :: Colour Double Source
#BA55D3
, rgb(186, 85, 211)
, hsl(288, 59%, 58%)
mediumpurple :: Colour Double Source
#9370DB
, rgb(147, 112, 219)
, hsl(260, 60%, 65%)
mediumseagreen :: Colour Double Source
#3CB371
, rgb(60, 179, 113)
, hsl(147, 50%, 47%)
mediumslateblue :: Colour Double Source
#7B68EE
, rgb(123, 104, 238)
, hsl(249, 80%, 67%)
mediumspringgreen :: Colour Double Source
#00FA9A
, rgb(0, 250, 154)
, hsl(157, 100%, 49%)
mediumturquoise :: Colour Double Source
#48D1CC
, rgb(72, 209, 204)
, hsl(178, 60%, 55%)
mediumvioletred :: Colour Double Source
#C71585
, rgb(199, 21, 133)
, hsl(322, 81%, 43%)
midnightblue :: Colour Double Source
#191970
, rgb(25, 25, 112)
, hsl(240, 64%, 27%)
navajowhite :: Colour Double Source
#FFDEAD
, rgb(255, 222, 173)
, hsl(36, 100%, 84%)
palegoldenrod :: Colour Double Source
#EEE8AA
, rgb(238, 232, 170)
, hsl(55, 67%, 80%)
paleturquoise :: Colour Double Source
#AFEEEE
, rgb(175, 238, 238)
, hsl(180, 65%, 81%)
palevioletred :: Colour Double Source
#DB7093
, rgb(219, 112, 147)
, hsl(340, 60%, 65%)
papayawhip :: Colour Double Source
#FFEFD5
, rgb(255, 239, 213)
, hsl(37, 100%, 92%)
powderblue :: Colour Double Source
#B0E0E6
, rgb(176, 224, 230)
, hsl(187, 52%, 80%)
saddlebrown :: Colour Double Source
#8B4513
, rgb(139, 69, 19)
, hsl(25, 76%, 31%)
sandybrown :: Colour Double Source
#F4A460
, rgb(244, 164, 96)
, hsl(28, 87%, 67%)
slategray :: Colour Double Source
#708090
, rgb(112, 128, 144)
, hsl(210, 13%, 50%)
. Same as slategrey
.
slategrey :: Colour Double Source
#708090
, rgb(112, 128, 144)
, hsl(210, 13%, 50%)
. Same as slategray
.
springgreen :: Colour Double Source
#00FF7F
, rgb(0, 255, 127)
, hsl(150, 100%, 50%)
whitesmoke :: Colour Double Source
#F5F5F5
, rgb(245, 245, 245)
, hsl(0, 0%, 96%)
yellowgreen :: Colour Double Source
#9ACD32
, rgb(154, 205, 50)
, hsl(80, 61%, 50%)
CSS Color Module Level 4 color
rebeccapurple :: Colour Double Source
#663399
, rgb(102, 51, 153)
, hsl(270, 50%, 40%)