vivid v0.1.1 Vivid.RGBA
Defines a colour in RGBA colour space.
Summary
Functions
Return the alpha component of the colour
Shorthand for black
Return the blue component of the colour
Return the green component of the colour
Create a colour. Like magic
Return the luminance of a colour, using some colour mixing ratios I found on stack exchange
Blend two colours together using their alpha information using the “over” algorithm
Return the red component of the colour
Convert a colour to HTML style hex
Shorthand for white
Functions
Return the alpha component of the colour.
Example
iex> Vivid.RGBA.init(0.7, 0.6, 0.5, 0.4)
...> |> Vivid.RGBA.alpha
0.4
Return the blue component of the colour.
Example
iex> Vivid.RGBA.init(0.7, 0.6, 0.5, 0.4)
...> |> Vivid.RGBA.blue
0.5
Return the green component of the colour.
Example
iex> Vivid.RGBA.init(0.7, 0.6, 0.5, 0.4)
...> |> Vivid.RGBA.green
0.6
Create a colour. Like magic.
Example
iex> Vivid.RGBA.init(0.1, 0.2, 0.3, 0.4)
#Vivid.RGBA<{0.1, 0.2, 0.3, 0.4}>
Return the luminance of a colour, using some colour mixing ratios I found on stack exchange.
Examples
iex> Vivid.RGBA.init(1,0,0) |> Vivid.RGBA.luminance
0.2128
iex> Vivid.RGBA.white |> Vivid.RGBA.luminance
1.0
iex> Vivid.RGBA.black |> Vivid.RGBA.luminance
0.0
Blend two colours together using their alpha information using the “over” algorithm.
Examples
iex> Vivid.RGBA.over(Vivid.RGBA.black, Vivid.RGBA.init(1,1,1, 0.5))
#Vivid.RGBA<{0.5, 0.5, 0.5, 1.0}>
Return the red component of the colour.
Example
iex> Vivid.RGBA.init(0.7, 0.6, 0.5, 0.4)
...> |> Vivid.RGBA.red
0.7