Browse Source

Return non normalized RGB values for consistency with input

master
Nicolas Goy 11 months ago
parent
commit
896630bb49
  1. 7
      lib/hsluv.ex
  2. 2
      mix.exs

7
lib/hsluv.ex

@ -64,10 +64,12 @@ defmodule HSLuv do
@doc """
Convert HSLuv to RGB.
Returned components are between 0 and 255 included
## Examples
iex> HSLuv.to_rgb(20, 50, 20)
{0.2934644509325827, 0.14978226541818696, 0.12310538660115919}
{75, 38, 31}
"""
def to_rgb(h, s, l) do
new(h, s, l)
@ -75,7 +77,8 @@ defmodule HSLuv do
end
def to_rgb(%HSLuv{h: h, s: s, l: l}) do
hsluv_to_rgb({h, s, l})
{r, g, b} = hsluv_to_rgb({h, s, l})
{round(r * 255.0), round(g * 255.0), round(b * 255.0)}
end
@doc """

2
mix.exs

@ -4,7 +4,7 @@ defmodule Hsluv.MixProject do
def project do
[
app: :hsluv,
version: "0.1.0",
version: "0.2.0",
elixir: "~> 1.10",
start_permanent: Mix.env() == :prod,
deps: deps(),

Loading…
Cancel
Save