RandomColor (random_color v0.1.0) View Source
Elixir port of davidmerfield/randomColor
Installation
The package can be installed
by adding random_color to your list of dependencies in mix.exs:
def deps do
[
{:random_color, "~> 0.1.0"}
]
endBasic Usage
RandomColor.hex() # #13B592
RandomColor.rgb() # {189, 81, 542}
RandomColor.rgb(format: :string) # rgb(189, 81, 542)
RandomColor.hex(hue: :red) # #9B112C
RandomColor.hex(hue: :red, luminosity: :light) # #FFB2CA
RandomColor.hsla([], 0.5) # hsla(117, 65.29%, 48.4%, 0.5)
Link to this section Summary
Functions
Generator a random color
Generator a random color
Generator a random color
Generator a random color
Generator a random color
Link to this section Functions
Generator a random color
Options
hue:-:monochrome,:red,:orange,:yellow,:green,:blue,:purple,:pinkluminosity:-:dark,:bright,:light,:random
Output Format
string-"#13B592"
Examples
iex> RandomColor.hex(hue: :blue)
Generator a random color
Options
hue:-:monochrome,:red,:orange,:yellow,:green,:blue,:purple,:pinkluminosity:-:dark,:bright,:light,:randomformat:-:string(default),:tuple
Output Format
string-"hsl(139, 82.32%, 71.725%)"tuple-{139, 82.32, 71.725}
Examples
iex> RandomColor.hsl(hue: :yellow, luminosity: :light)
Generator a random color
Options
hue:-:monochrome,:red,:orange,:yellow,:green,:blue,:purple,:pinkluminosity:-:dark,:bright,:light,:randomformat:-:string(default),:tuple
alpha a value between 0.0 and 1.0
Output Format
string-"hsl(139, 82.32%, 71.725%)"tuple-{139, 82.32, 71.725}
Examples
iex> RandomColor.hsl(hue: :yellow, luminosity: :light)
Generator a random color
Options
hue:-:monochrome,:red,:orange,:yellow,:green,:blue,:purple,:pinkluminosity:-:dark,:bright,:light,:randomformat:-:string(default),:tuple
Output Format
string-"rgb(221, 186, 95)"tuple-{221, 186, 95}
Examples
iex> RandomColor.rgb(hue: :red, luminosity: :light)
Generator a random color
Options
hue:-:monochrome,:red,:orange,:yellow,:green,:blue,:purple,:pinkluminosity:-:dark,:bright,:light,:randomformat:-:string(default),:tuple
alpha a value between 0.0 and 1.0
Output Format
string-"rgba(221, 186, 95, 0.1)"tuple-{221, 186, 95, 0.1}
Examples
iex> RandomColor.rgba([hue: :purple], 0.8)