Skip to content

rafalgolarz/claritas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Claritas

Hex.pm Downloads Build Status

Library for generating different variations of brightness for given color.

Installation

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.

Basic Usage

positive values are lightening the color

iex> Claritas.shift("#f06d06", 30)
{:ok, "#FF8B24"}

negative values are darkening the color

iex> Claritas.shift("#f06d06", -30)
{:ok, "#D24F00"}

Dynamically increase/decrease brightness of your colors.

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:

Author

Rafał Golarz

Claritas is released under the MIT License.

About

Generate different variations of brightness for the given color.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages