Created
February 12, 2016 20:58
-
-
Save JoeyEremondi/76a46d796f903b74de9c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Color exposing (..) | |
import Graphics.Element exposing (show) | |
d x = x | |
f x = x | |
labToColor : { l : Float, a : Float, b : Float } -> Color | |
labToColor { l, a, b } = | |
let | |
y = (l + 16) / 116 | |
x = y + a / 500 | |
z = y - b / 200 | |
y' = d y | |
x' =(d x) * 0.95047 | |
z' = (d z) * 1.08883 | |
in | |
let | |
r = x' * 3.2404542 + y' * -1.5371385 + z' * -0.4986 | |
g = x' * -0.969266 + y' * 1.8760108 + z' * 4.1556e-2 | |
b = x' * 5.56434e-2 + y' * 0.2040259 + z' * 1.0572252 | |
in | |
Debug.log | |
"rgb" | |
(rgb | |
(round (f r) * 255) | |
(round (f g) * 255) | |
(round (f b) * 255) | |
) | |
main = | |
let cr = labToColor {l = 1, a = 1, b = 1} | |
in show cr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment