Module

CSS

Package
purescript-css
Repository
purescript-contrib/purescript-css

Re-exports from CSS.Animation

#FillMode Source

Re-exports from CSS.Background

#Background Source

class (Val a) <= Background a  where

We implement the generic background property as a type class that accepts multiple value types. This allows us to combine different background aspects into a shorthand syntax.

Members

Instances

#Loc Source

class (Val a) <= Loc a  where

Members

Instances

#sideTop Source

sideTop :: Side

We have to prefix these values to avoid conflict with existing property

#sideRight Source

#sideMiddle Source

#sideLeft Source

#sideCenter Source

#sideBottom Source

#positioned Source

positioned :: forall a. Size a -> Size a -> BackgroundPosition

#by Source

by :: forall a b. Size a -> Size b -> BackgroundSize

#backgroundColor Source

#angular Source

angular :: forall a. Angle a -> Direction

Re-exports from CSS.Border

#outlineStyle Source

#outlineColor Source

#borderSpacing Source

borderSpacing :: forall a. Size a -> CSS

#borderRadius Source

borderRadius :: forall a. Size a -> Size a -> Size a -> Size a -> CSS

#borderColor Source

Re-exports from CSS.Box

#paddingBox Source

paddingBox :: BoxType

DEPRECATED

#boxSizing Source

#boxShadow Source

boxShadow :: NonEmpty Array BoxShadow -> CSS

This function will usually take a singleton list, but requiring a (non-empty) list prevents accidentally applying the modifiers (bsInset, bsColor) incorrectly.

singleton (from "Data.NonEmpty") creates a singleton list.

boxShadow $ singleton $ shadow (px 1.0) (px 1.0)

For supplying multiple BoxShadow values:

boxShadow $
  red `bsColor` shadow (px 3.0) (px 3.0) :|
  [olive `bsColor` shadowWithBlur (em (-1.0)) (em 0.0) (em 0.4)]

Re-exports from CSS.Color

#ColorSpace Source

data ColorSpace

Definition of a color space.

  • RGB: red, green, blue
  • HSL: hue, saturation, lightness
  • LCh: Lightness, chroma, hue
  • Lab: Lightness, a, b

Constructors

#Color Source

data Color

The representation of a color.

Note:

  • The Eq instance compares two Colors 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 -> Color

Create 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:

#white Source

white :: Color

Pure white.

#toXYZ Source

toXYZ :: Color -> { x :: Number, y :: Number, z :: Number }

Get XYZ coordinates according to the CIE 1931 color space.

See:

#toRGBA' Source

toRGBA' :: Color -> { a :: Number, b :: Number, g :: Number, r :: Number }

Convert a Color to its red, green, blue and alpha values. All values are numbers in the range from 0.0 to 1.0.

#toRGBA Source

toRGBA :: Color -> { a :: Number, b :: Int, g :: Int, r :: Int }

Convert a Color to its red, green, blue and alpha values. The RGB values are integers in the range from 0 to 255. The alpha channel is a number between 0.0 and 1.0.

#toLab Source

toLab :: Color -> { a :: Number, b :: Number, l :: Number }

Get L, a and b coordinates according to the Lab color space.

See: https://en.wikipedia.org/wiki/Lab_color_space

#toLCh Source

toLCh :: Color -> { c :: Number, h :: Number, l :: Number }

Get L, C and h coordinates according to the CIE LCh color space.

See: https://en.wikipedia.org/wiki/Lab_color_space

#toHexString Source

toHexString :: Color -> String

Return a hexadecimal representation of the color in the forms #rrggbb or #rrggbbaa, where rr, gg, bb, and aa refer to hexadecimal digits corresponding to the RGBA channel values between 00 and ff. The alpha channel is only represented when it has a value less than 100%.

#toHSLA Source

toHSLA :: Color -> { a :: Number, h :: Number, l :: Number, s :: Number }

Convert a Color to its Hue, Saturation, Lightness and Alpha values. See hsla for the ranges of each channel.

#toGray Source

toGray :: Color -> Color

Convert a color to a gray tone with the same perceived luminance (see luminance).

#textColor Source

textColor :: Color -> Color

Return a readable foreground text color (either black or white) for a given background color.

#saturate Source

saturate :: Number -> Color -> Color

Increase the saturation of a color by adding a certain amount (number between -1.0 and 1.0) to the saturation channel. If the number is negative, the color is desaturated.

#rotateHue Source

rotateHue :: Number -> Color -> Color

Rotate the hue of a Color by a certain angle (in degrees).

#rgba' Source

rgba' :: Number -> Number -> Number -> Number -> Color

Create a Color from RGB and alpha values between 0.0 and 1.0.

#rgba Source

rgba :: Int -> Int -> Int -> Number -> Color

Create a Color from integer RGB values between 0 and 255 and a floating point alpha value between 0.0 and 1.0.

#rgb' Source

rgb' :: Number -> Number -> Number -> Color

Create a Color from RGB values between 0.0 and 1.0.

#rgb Source

rgb :: Int -> Int -> Int -> Color

Create a Color from integer RGB values between 0 and 255.

#mix Source

mix :: ColorSpace -> Interpolator

Mix two colors by linearly interpolating between them in the specified color space. For the HSL colorspace, the shortest path is chosen along the circle of hue values.

#luminance Source

luminance :: Color -> Number

The 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

#lighten Source

lighten :: Number -> Color -> Color

Lighten a color by adding a certain amount (number between -1.0 and 1.0) to the lightness channel. If the number is negative, the color is darkened.

#lch Source

lch :: Number -> Number -> Number -> Color

Create a Color from lightness, chroma and hue coordinates in the CIE LCh color space. This is a cylindrical transform of the Lab color space. Note: See documentation for xyz. The same restrictions apply here.

See: https://en.wikipedia.org/wiki/Lab_color_space

#lab Source

lab :: Number -> Number -> Number -> Color

Create a Color from L, a and b coordinates coordinates in the Lab color space. Note: See documentation for xyz. The same restrictions apply here.

See: https://en.wikipedia.org/wiki/Lab_color_space

#isReadable Source

isReadable :: Color -> Color -> Boolean

Determine 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

#isLight Source

isLight :: Color -> Boolean

Determine whether a color is perceived as a light color.

isLight c = brightness c > 0.5

#hsla Source

hsla :: Number -> Number -> Number -> Number -> Color

Create a Color from Hue, Saturation, Lightness and Alpha values. The Hue is given in degrees, as a Number between 0.0 and 360.0. Saturation, Lightness and Alpha are numbers between 0.0 and 1.0.

#hsl Source

hsl :: Number -> Number -> Number -> Color

Create a Color from Hue, Saturation and Lightness values. The Hue is given in degrees, as a Number between 0.0 and 360.0. Both Saturation and Lightness are numbers between 0.0 and 1.0.

#graytone Source

graytone :: Number -> Color

Create a gray tone from a lightness values (0.0 is black, 1.0 is white).

#fromInt Source

fromInt :: Int -> Color

Converts an integer to a color (RGB representation). 0 is black and 0xffffff is white. Values outside this range will be clamped.

This function is useful if you want to hard-code Hex values. For example:

red = fromInt 0xff0000

#fromHexString Source

fromHexString :: String -> Maybe Color

Parse 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.

#distance Source

distance :: Color -> Color -> Number

Compute the perceived 'distance' between two colors according to the CIE76 delta-E standard. A distance below ~2.3 is not noticable.

See: https://en.wikipedia.org/wiki/Color_difference

#desaturate Source

desaturate :: Number -> Color -> Color

Decrease 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.

#darken Source

darken :: Number -> Color -> Color

Darken a color by subtracting a certain amount (number between -1.0 and 1.0) from the lightness channel. If the number is negative, the color is lightened.

#cssStringRGBA Source

cssStringRGBA :: Color -> String

A CSS representation of the color in the form rgb(..) or rgba(...).

#cssStringHSLA Source

cssStringHSLA :: Color -> String

A CSS representation of the color in the form hsl(..) or hsla(...).

#contrast Source

contrast :: Color -> Color -> Number

The 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 -> Color

Get the complementary color (hue rotated by 180°).

#brightness Source

brightness :: Color -> Number

The percieved brightness of the color (A number between 0.0 and 1.0).

See: https://www.w3.org/TR/AERT#color-contrast

#black Source

black :: Color

Pure black.

Re-exports from CSS.Cursor

#cursor Source

Re-exports from CSS.Display

#Position Source

#Display Source

newtype Display

Constructors

Instances

#zIndex Source

zIndex :: Int -> CSS

#tableRowGroup Source

#tableHeaderGroup Source

#tableFooterGroup Source

#tableColumnGroup Source

#opacity Source

#floatRight Source

#floatLeft Source

#float Source

#displayInherit Source

#display Source

Re-exports from CSS.Elements

Re-exports from CSS.Flexbox

#order Source

order :: Int -> CSS

#flexShrink Source

#flexGrow Source

#flexBasis Source

flexBasis :: forall a. Size a -> CSS

Re-exports from CSS.Font

#fontSize Source

fontSize :: forall a. Size a -> CSS

#color Source

Re-exports from CSS.FontFace

#fontFaceFamily Source

Re-exports from CSS.FontStyle

Re-exports from CSS.Geometry

#width Source

width :: forall a. Size a -> CSS

#top Source

top :: forall a. Size a -> CSS

#right Source

right :: forall a. Size a -> CSS

#paddingTop Source

paddingTop :: forall a. Size a -> CSS

#paddingRight Source

paddingRight :: forall a. Size a -> CSS

#paddingLeft Source

paddingLeft :: forall a. Size a -> CSS

#paddingBottom Source

paddingBottom :: forall a. Size a -> CSS

#padding Source

padding :: forall a. Size a -> Size a -> Size a -> Size a -> CSS

#minWidth Source

minWidth :: forall a. Size a -> CSS

#minHeight Source

minHeight :: forall a. Size a -> CSS

#maxWidth Source

maxWidth :: forall a. Size a -> CSS

#maxHeight Source

maxHeight :: forall a. Size a -> CSS

#marginTop Source

marginTop :: forall a. Size a -> CSS

#marginRight Source

marginRight :: forall a. Size a -> CSS

#marginLeft Source

marginLeft :: forall a. Size a -> CSS

#marginBottom Source

marginBottom :: forall a. Size a -> CSS

#margin Source

margin :: forall a. Size a -> Size a -> Size a -> Size a -> CSS

#lineHeight Source

lineHeight :: forall a. Size a -> CSS

#left Source

left :: forall a. Size a -> CSS

#height Source

height :: forall a. Size a -> CSS

#bottom Source

bottom :: forall a. Size a -> CSS

Re-exports from CSS.Gradient

#repeatingRadialGradient Source

#radialGradient Source

radialGradient :: forall l. Loc l => l -> Radial -> Ramp -> BackgroundImage

#farthestSide Source

#farthestCorner Source

#elliptical Source

elliptical :: forall a. Size a -> Size a -> Radial

#closestSide Source

#closestCorner Source

Re-exports from CSS.Property

#Literal Source

newtype Literal

Constructors

Instances

#Key Source

newtype Key a

Constructors

Instances

#Val Source

class Val a  where

Members

Instances

#noCommas Source

noCommas :: forall a. Val a => Array a -> Value

#cast Source

cast :: forall a. Key a -> Key Unit

#(!) Source

Operator alias for Data.Tuple.Tuple (right-associative / precedence 9)

Re-exports from CSS.Pseudo

Re-exports from CSS.Render

#rule' Source

rule' :: forall a. Array App -> Array (Tuple (Key a) Value) -> Rendered

#render Source

render :: forall a. StyleM a -> Rendered

#putStyleSheet Source

#nel Source

nel :: forall a. Array a -> Maybe (NonEmpty Array a)

#collect Source

Re-exports from CSS.Selector

#Path Source

data Path f

Constructors

Instances

#star Source

star :: Selector

The star selector applies to all elements. Maps to * in CSS.

#pseudo Source

pseudo :: String -> Refinement

Filter elements by pseudo selector or pseudo class. The preferred syntax is to use :pseudo-selector or use one of the predefined ones from CSS.Pseudo.

#func Source

func :: String -> Array String -> Refinement

Filter elements by pseudo selector functions. The preferred way is to use one of the predefined functions from CSS.Pseudo.

#element Source

element :: String -> Selector

Select elements by name.

#byId Source

byId :: String -> Refinement

Filter elements by id.

#byClass Source

byClass :: String -> Refinement

Filter elements by class.

#attr Source

attr :: String -> Refinement

Filter elements based on the presence of a certain attribute.

#(~=) Source

Operator alias for CSS.Selector.attrSpace (non-associative / precedence 6)

#(|>) Source

Operator alias for CSS.Selector.child (non-associative / precedence 6)

#(|=) Source

Operator alias for CSS.Selector.attrHyph (non-associative / precedence 6)

#(|+) Source

Operator alias for CSS.Selector.adjacent (non-associative / precedence 6)

#(|*) Source

Operator alias for CSS.Selector.deep (non-associative / precedence 6)

#(^=) Source

Operator alias for CSS.Selector.attrBegins (non-associative / precedence 6)

#(@=) Source

Operator alias for CSS.Selector.attrVal (non-associative / precedence 6)

#(*=) Source

Operator alias for CSS.Selector.attrContains (non-associative / precedence 6)

#(&) Source

Operator alias for CSS.Selector.with (non-associative / precedence 6)

#($=) Source

Operator alias for CSS.Selector.attrEnds (non-associative / precedence 6)

Re-exports from CSS.Size

#Rad Source

data Rad

#Deg Source

data Deg

#Angle Source

newtype Angle a

Constructors

Instances

#vw Source

vw :: Number -> Size LengthUnit

Size in vw's (1vw = 1% of viewport width).

#vmin Source

vmin :: Number -> Size LengthUnit

Size in vmin's (the smaller of vw or vh).

#vmax Source

vmax :: Number -> Size LengthUnit

Size in vmax's (the larger of vw or vh).

#vh Source

vh :: Number -> Size LengthUnit

Size in vh's (1vh = 1% of viewport height).

#sym Source

sym :: forall a b. (a -> a -> a -> a -> b) -> a -> b

#rem Source

rem :: Number -> Size LengthUnit

Size in rem's.

#rad Source

rad :: Number -> Angle Rad

Angle in radians.

#px Source

px :: Number -> Size LengthUnit

Size in pixels.

#pt Source

pt :: Number -> Size LengthUnit

Size in points (1pt = 1/72 of 1in).

#pct Source

pct :: Number -> Size Percentage

SimpleSize in percents.

#nil Source

nil :: forall a. Size a

Zero size.

#ex Source

ex :: Number -> Size LengthUnit

Size in ex'es (x-height of the first avaliable font).

#em Source

em :: Number -> Size LengthUnit

Size in em's.

#deg Source

deg :: Number -> Angle Deg

Angle in degrees.

#(@/) Source

Operator alias for CSS.Size.calcDiv (left-associative / precedence 7)

#(@-@) Source

Operator alias for CSS.Size.calcDiff (left-associative / precedence 6)

#(@+@) Source

Operator alias for CSS.Size.calcSum (left-associative / precedence 6)

#(@*) Source

Operator alias for CSS.Size.calcMultFlipped (left-associative / precedence 7)

#(*@) Source

Operator alias for CSS.Size.calcMult (left-associative / precedence 7)

Re-exports from CSS.String

#IsString Source

class IsString s  where

Members

Instances

Re-exports from CSS.Stylesheet

#NotOrOnly Source

data NotOrOnly

Constructors

Instances

#MediaType Source

newtype MediaType

Constructors

Instances

#Feature Source

data Feature

Constructors

Instances

#select Source

#runS Source

runS :: forall a. StyleM a -> Array Rule

#rule Source

rule :: Rule -> CSS

#prefixed Source

prefixed :: forall a. Val a => Prefixed -> a -> CSS

#keyframesFromTo Source

#key Source

key :: forall a. Val a => Key a -> a -> CSS

#importUrl Source

#fontFace Source

#(?) Source

Operator alias for CSS.Stylesheet.select (right-associative / precedence 5)

Re-exports from CSS.Text

#letterSpacing Source

letterSpacing :: forall a. Size a -> CSS

Re-exports from CSS.Text.Direction

Re-exports from CSS.Text.Overflow

Re-exports from CSS.Text.Transform

Re-exports from CSS.Text.Whitespace

Re-exports from CSS.Time

#Time Source

newtype Time

Constructors

Instances

Re-exports from CSS.Transform

#translate Source

translate :: forall a b. Size a -> Size b -> Transformation

#transformOrigin Source

#rotate Source

rotate :: forall a. Angle a -> Transformation

#offsetTop Source

#offsetRight Source

#offsetLeft Source

#offsetCenter Source

#offsetBottom Source

#offset Source

offset :: forall a. Size a -> TransformOriginOffset a

Re-exports from CSS.Transition

#transitionTimingFunction Source

#transitionProperty Source

#transitionProperties Source

#transitionDurations Source

#transitionDuration Source

#transitionDelays Source

#transitionDelay Source