Skip to content

max2320/viridis

Repository files navigation

Viridis

The viridis gem is a set of helpers to generate viridis (viridis, magma, inferno, plasma) color palettes.

This repo was inpired on https://github.com/d3/d3-scale-chromatic

Installation

Add this line to your application's Gemfile:

gem 'viridis'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install viridis

Usage

Generating palette colors

Viridis palette

Viridis.range(10)

[ "#440154", "#482878", "#3e4989", "#31688e", "#26828e", "#1f9e89", "#35b779", "#6ece58", "#b5de2b", "#fde725"]

Magma palette

Viridis::Magma.range(10)

["#000004", "#180f3d", "#440f76", "#721f81", "#9e2f7f", "#cd4071", "#f1605d", "#fd9668", "#feca8d", "#fcfdbf"]

Inferno palette

Viridis::Inferno.range(10)

["#000004", "#1b0c41", "#4a0c6b", "#781c6d", "#a52c60", "#cf4446", "#ed6925", "#fb9b06", "#f7d13d", "#fcffa4"]

Plama palette

Viridis::Plasma.range(10)

["#0d0887", "#46039f", "#7201a8", "#9c179e", "#bd3786", "#d8576b", "#ed7953", "#fb9f3a", "#fdca26", "#f0f921"]

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/viridis. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Viridis project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.