HSLuv implementation in elm
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Nicolas Goy 4f301299d8 Ensure newline at end 3 years ago
src Use new elm color type 3 years ago
tests Use new elm color type 3 years ago
.editorconfig Test runner 4 years ago
.gitignore Test runner 4 years ago
.travis.yml Update elm 3 years ago
LICENSE Upgrade for elm 0.19 3 years ago
Makefile Ensuite only one file is tested 3 years ago
README.md Format 3 years ago
elm.json Ensure newline at end 3 years ago

README.md

HSLuv implementation in pure Elm

Build Status

Convert between HSLuv and RGB.

HSLuv references: http://www.hsluv.org/

The Color type is provided by the new color package from avh4.

Note: If you plan to manipulate HSLuv colors, store them with the provided HSLuv type and convert them to Color at the last possible time as the conversion can be expensive. If you just use HSLuv as constructor, you may write an helper like: color h s l = HSLuv.hsluv360 { hue = h, saturation = s, lightness = l, alpha = 1} |> HSLuv.toColor

Basic Usage

-- create an HSLuv color with a Color
c = HSLuv.color myColor

-- create an HSLuv color with components
c = HSLuv.hsluv360 { hue = 150, saturation = 100, lightness = 50, alpha = 1 }

-- turn a color into normalized components
{ red, green, saturation, lightness } = HSLuv.rgba c

-- turn and HSLuv color into a Color
color = HSLuv.toColor c

Compatibility

  • Latest version is targeted at elm 0.19.
  • Version 1.0.1 is the last version compatible with elm 0.18.