ColorContrast.ex

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

Installation

If available in Hex, the package can be installed by adding color_contrast to your list of dependencies in mix.exs:

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

Usage

Give it a hexadecimal string:

ColorContrast.color_contrast("#000000") # => "#ffffff"

License

MIT