Library for generating different variations of brightness for given color.
The package can be installed by adding claritas
to your list of dependencies in mix.exs
:
def deps do
[
{:claritas, "~> 0.1.1"}
]
end
and running mix deps.get
in your console to fetch from Hex.
iex> Claritas.shift("#f06d06", 30)
{:ok, "#FF8B24"}
iex> Claritas.shift("#f06d06", -30)
{:ok, "#D24F00"}
Controller:
def index(conn, _params) do
shades =
for i <- 1..20, into: [] do
Claritas.shift("#141C5B", 10 * i)
end
render(conn, "index.html", shades: shades)
end
Template:
<ul>
<%= for {_, shade} <- @shades do %>
<li><span style='background-color: <%= shade %>'><%= shade %></span></li>
<% end %>
</ul>
Output:
Rafał Golarz
Claritas is released under the MIT License.