Skip to content

mconnell/human_colour

Repository files navigation

HumanColour

Gem Version

Simple gem for taking an RGB colour string, and converting it into a human-friendly name.

Installation

Install the gem and add to the application's Gemfile by executing:

bundle add human_colour

If bundler is not being used to manage dependencies, install the gem by executing:

gem install human_colour

Usage

  require "human_colour"

  HumanColour.parse("rgb(128,64,0)")
  #=> "brown"

  HumanColour.parse("rgb(30, 20, 10)")
  #=> "near black"

  # Return a colour based on the provided locale (:de, :en, :es, :fr, :it, :pt)
  HumanColour.parse("rgb(128,64,0)", locale: :es)
  #=> "marrón"

  HumanColour.parse("rgb(255, 128, 255", locale: :de)
  #=> "hell lila"

alt text

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 the created tag, and push the .gem file to rubygems.org.

License

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

About

Small library to help convert a computer-friendly colour into something human-friendly

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published