CSSEx.RGBA (CSSEx v0.6.6) View Source

Struct and helper functions for generating RGBA values.

Link to this section 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.

Link to this section Types

Link to this section 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

Link to this function

new(r, g, b, a, base \\ 10)

View Source

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.