Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/knl/name-this-color.el
Match RGB codes (color codes, HTML colors) to names easily and precisely.
https://github.com/knl/name-this-color.el
Last synced: 13 days ago
JSON representation
Match RGB codes (color codes, HTML colors) to names easily and precisely.
- Host: GitHub
- URL: https://github.com/knl/name-this-color.el
- Owner: knl
- License: bsd-2-clause
- Created: 2015-10-11T08:22:05.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-10-15T20:22:29.000Z (about 9 years ago)
- Last Synced: 2024-10-12T00:31:22.234Z (about 1 month ago)
- Language: Emacs Lisp
- Size: 279 KB
- Stars: 3
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.org
- License: LICENSE
Awesome Lists containing this project
README
#+TITLE: name-this-color.el
#+AUTHOR: Nikola Knezevic
#+EMAIL: [email protected][[http://melpa.org/#/name-this-color][file:http://melpa.org/packages/name-this-color-badge.svg]]
Match RGB codes (color codes, HTML colors) to names easily and precisely.
Color names and shades are taken from [[http://chir.ag/projects/ntc/][Name that Color JavaScript]] by Chirag Mehta
and [[http://www.color-blindness.com/color-name-hue/][Color Name & Hue]] by Colblindor.* Installation
It's available on [[http://melpa.milkbox.net/][Melpa]]:
#+BEGIN_EXAMPLE
M-x package-install name-this-color
#+END_EXAMPLEOr you can just dump =name-this-color.el= in your load path somewhere.
* Using in a package
Add this to the big comment block at the top:
#+BEGIN_EXAMPLE
;; Package-Requires: ((name-this-color "0.2.0"))
#+END_EXAMPLE* Functions
** =ntc-name-this-color (code)=Returns the name of the color represented by color code or the name of the
closest alternative.=code= should be a string naming a color (for example, "white") or a string
specifying a color's RGB components (for example, "#ff12ec" or "f0f0f0"). Note
that only valid color names (per =color.el=) and RGB codes (6 characters,
possibly prepended by a '#') are recognized.#+BEGIN_SRC cl
(ntc-name-this-color "#f3f3f3") ; "White Smoke"
(ntc-name-this-color "white") ; "White"
(ntc-name-this-color "#0c0000") ; "Free Speech Red"
(ntc-name-this-color "ff12ec") ; "Magenta"
#+END_SRC** =ntc-shade-this-color (code)=
Returns the shade of the color represented by color code or the shade of the
closest alternative.Shade could be one of the following: Red, Orange, Brown, Yellow, Green, Blue,
Violet, Gray, or White.=code= should be a string naming a color (for example, "white") or a string
specifying a color's RGB components (for example, "#ff12ec" or "f0f0f0"). Note
that only valid color names (per =color.el=) and RGB codes (6 characters,
possibly prepended by a '#') are recognized.#+BEGIN_SRC cl
(ntc-shade-this-color "#f3f3f3") ; "White"
(ntc-shade-this-color "white") ; "White"
(ntc-shade-this-color "#0c0000") ; "Red"
(ntc-shade-this-color "ff12ec") ; "Violet"
#+END_SRC* Changelist
** 0.2.0
- Change the API, prefix all methods with =ntc-=, per [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Coding-Conventions.html][elisp coding guidelines]]
** 0.1.0
- Initial code drop