Skip to content

elixir library to select black or white depending on contrast with another color

License

Notifications You must be signed in to change notification settings

shadows-withal/colorcontrast.ex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ColorContrast.ex

An Elixir library to select black or white depending on the contrast to a hexadecimal background color.

Installation

The package can be installed by adding color_contrast to your list of dependencies in mix.exs:

def deps do
  [
    {:color_contrast, "~> 1.1"}
  ]
end

The docs can be found at https://hexdocs.pm/color_contrast.

Usage

Give it a hexadecimal string:

iex> ColorContrast.calc_contrast("#000000")
{:ok, "#FFFFFF"}

License

MIT

About

elixir library to select black or white depending on contrast with another color

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages