View Source CSSEx.RGBA (CSSEx v1.0.2)
Struct and helper functions for generating RGBA values.
Summary
Functions
Converts an existing %CSSEx.HSLA{}
struct into a %CSSEx.RGBA{}
struct.
Taken from https://www.niwa.nu/2013/05/math-behind-colorspace-conversions-rgb-hsl
Generates a %CSSEx.RGBA{}
wrapped in an :ok tuple, from the values of r, g, b, and alpha. All values are treated as decimal by default but another base can be provided as an optional argument.
Accepts any value in the form of a binary "hsla(0, 10%, 20%, 0.5)"
or "hsl(0, 10%, 20%)"
, any hexadecimal representation in binary in the form of "#xxx"
, "#xxxx"
, "#xxxxxx"
or "#xxxxxxxx"
, rgb/a as "rgba(100,100,100,0.1)"
or "rgb(10,20,30)"
, or any literal color name defined as web colors (CSSEx.Colors) - returns a %CSSEx.HSLA{}
struct.
Types
@type t() :: %CSSEx.RGBA{ a: non_neg_integer(), b: non_neg_integer(), g: non_neg_integer(), r: non_neg_integer() }
Functions
Converts an existing %CSSEx.HSLA{}
struct into a %CSSEx.RGBA{}
struct.
Taken from https://www.niwa.nu/2013/05/math-behind-colorspace-conversions-rgb-hsl
Generates a %CSSEx.RGBA{}
wrapped in an :ok tuple, from the values of r, g, b, and alpha. All values are treated as decimal by default but another base can be provided as an optional argument.
Accepts any value in the form of a binary "hsla(0, 10%, 20%, 0.5)"
or "hsl(0, 10%, 20%)"
, any hexadecimal representation in binary in the form of "#xxx"
, "#xxxx"
, "#xxxxxx"
or "#xxxxxxxx"
, rgb/a as "rgba(100,100,100,0.1)"
or "rgb(10,20,30)"
, or any literal color name defined as web colors (CSSEx.Colors) - returns a %CSSEx.HSLA{}
struct.