Flare.Drawing
- Package
- purescript-flare
- Repository
- sharkdp/purescript-flare
#runFlareDrawing Source
runFlareDrawing :: forall e. ElementId -> ElementId -> UI (canvas :: CANVAS | e) Drawing -> Eff (canvas :: CANVAS, channel :: CHANNEL, dom :: DOM | e) UnitRenders a Flare UI with a Drawing as output. The first ID specifies
the DOM element for the controls while the second ID specifies the
canvas for rendering.
Re-exports from Graphics.Drawing
#OutlineStyle Source
#ColorSpace Source
data ColorSpaceDefinition of a color space.
RGB: red, green, blueHSL: hue, saturation, lightnessLCh: Lightness, chroma, hueLab: Lightness, a, b
Constructors
#Color Source
data ColorThe representation of a color.
Note:
- The
Eqinstance compares twoColors by comparing their (integer) RGB values. This is different from comparing the HSL values (for example, HSL has many different representations of black (arbitrary hue and saturation values). - Colors outside the sRGB gamut which cannot be displayed on a typical
computer screen can not be represented by
Color.
Instances
#xyz Source
xyz :: Number -> Number -> Number -> ColorCreate a Color from XYZ coordinates in the CIE 1931 color space. Note
that a Color always represents a color in the sRGB gamut (colors that
can be represented on a typical computer screen) while the XYZ color space
is bigger. This function will tend to create fully saturated colors at the
edge of the sRGB gamut if the coordinates lie outside the sRGB range.
See:
#toXYZ Source
#toHexString Source
toHexString :: Color -> StringReturn a hexadecimal representation of the color in the form #rrggbb,
where rr, gg and bb refer to hexadecimal digits corresponding to
the RGB channel values between 00 and ff. The alpha channel is not
represented.
#shadowColor Source
shadowColor :: Color -> ShadowSet the shadow color.
#shadowBlur Source
shadowBlur :: Number -> ShadowSet the shadow blur.
#outlineColor Source
outlineColor :: Color -> OutlineStyleSet the outline color.
#luminance Source
luminance :: Color -> NumberThe relative brightness of a color (normalized to 0.0 for darkest black and 1.0 for lightest white), according to the WCAG definition.
See: https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
#lineWidth Source
lineWidth :: Number -> OutlineStyleSet the line width.
#lch Source
#isReadable Source
isReadable :: Color -> Color -> BooleanDetermine whether text of one color is readable on a background of a
different color (see contrast). This function is symmetric in both
arguments.
isReadable c1 c2 = contrast c1 c2 > 4.5
#fromHexString Source
fromHexString :: String -> Maybe ColorParse a hexadecimal RGB code of the form #rgb or #rrggbb. The #
character is required. Each hexadecimal digit is of the form [0-9a-fA-F]
(case insensitive). Returns Nothing if the string is in a wrong format.
#fontString Source
fontString :: Font -> StringTurn a Font into a String which can be used with Graphics.Canvas.setFont.
#everywhere Source
everywhere :: (Drawing -> Drawing) -> Drawing -> DrawingModify a Drawing by applying a transformation to every subdrawing.
#distance Source
#desaturate Source
desaturate :: Number -> Color -> ColorDecrease the saturation of a color by subtracting a certain amount (number between -1.0 and 1.0) from the saturation channel. If the number is negative, the color is saturated.
#cssStringRGBA Source
cssStringRGBA :: Color -> StringA CSS representation of the color in the form rgb(..) or rgba(...).
#cssStringHSLA Source
cssStringHSLA :: Color -> StringA CSS representation of the color in the form hsl(..) or hsla(...).
#contrast Source
contrast :: Color -> Color -> NumberThe contrast ratio of two colors. A minimum contrast ratio of 4.5 is
recommended to ensure that text is readable on a colored background. The
contrast ratio is symmetric on both arguments:
contrast c1 c2 == contrast c2 c1.
See http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef
#complementary Source
complementary :: Color -> ColorGet the complementary color (hue rotated by 180°).
#brightness Source
brightness :: Color -> NumberThe percieved brightness of the color (A number between 0.0 and 1.0).
- Modules
- Flare
- Flare.
Drawing - Flare.
Smolder