https://github.com/rafalgolarz/claritas
Generate different variations of brightness for the given color.
https://github.com/rafalgolarz/claritas
colors elixir elixir-lang hex package
Last synced: 8 months ago
JSON representation
Generate different variations of brightness for the given color.
- Host: GitHub
- URL: https://github.com/rafalgolarz/claritas
- Owner: rafalgolarz
- License: mit
- Created: 2020-01-29T08:26:46.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-12T12:31:27.000Z (over 6 years ago)
- Last Synced: 2025-06-28T22:37:14.555Z (12 months ago)
- Topics: colors, elixir, elixir-lang, hex, package
- Language: Elixir
- Homepage: https://hex.pm/packages/claritas
- Size: 110 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Claritas
[](https://hex.pm/packages/claritas)
[](https://hex.pm/packages/claritas)
[](https://travis-ci.org/rafalgolarz/claritas)
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`:
```elixir
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:
```
- <%= shade %>
<%= for {_, shade} <- @shades do %>
<% end %>
```
Output:

## Author
Rafał Golarz
Claritas is released under the [MIT License](https://github.com/rafalgolarz/claritas/blob/master/LICENSE.txt).