Box.Color (box v0.15.1)

View Source

Summary

Types

alpha()

@type alpha() :: percent()

degree()

@type degree() :: 0..359

format()

@type format() :: :hsl | :rgb

hex()

@type hex() :: 0..255

hsl()

@type hsl() :: {degree(), percent(), percent()}

percent()

@type percent() :: 0..100

rgb()

@type rgb() :: {hex(), hex(), hex()}

source()

@type source() :: format() | :hex

t()

@type t() :: %Box.Color{
  alpha: alpha(),
  format: format(),
  source: source(),
  value: hsl() | rgb()
}

to_css_option()

@type to_css_option() :: {:with_alpha, boolean()}

to_hex_option()

@type to_hex_option() :: {:with_alpha, boolean()}

Functions

hsl!(arg, alpha \\ 100)

@spec hsl!(hsl(), alpha()) :: t()

hsl?(color)

@spec hsl?(t()) :: boolean()

parse!(string)

@spec parse!(String.t()) :: t()

put_alpha(color, alpha)

@spec put_alpha(t(), alpha()) :: t()

range(color)

rgb!(arg, alpha \\ 100)

@spec rgb!(rgb(), alpha()) :: t()

rgb?(color)

@spec rgb?(t()) :: boolean()

rgb_from_hex!(hex)

@spec rgb_from_hex!(String.t()) :: t()

to_css(color, options \\ [])

@spec to_css(t(), [to_css_option()]) :: String.t()

to_css_hsl(color, options)

to_css_rgb(color, options)

to_hex(color, options \\ [])

@spec to_hex(t(), [to_hex_option()]) :: String.t()

to_hsl(color)

@spec to_hsl(t()) :: t()

to_rgb(color)

@spec to_rgb(t()) :: t()