Skip to content

Match RGB codes (color codes, HTML colors) to names easily and precisely.

License

Notifications You must be signed in to change notification settings

knl/name-this-color.el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

name-this-color.el

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 Name that Color JavaScript by Chirag Mehta and Color Name & Hue by Colblindor.

Installation

It’s available on Melpa:

M-x package-install name-this-color

Or 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:

;; Package-Requires: ((name-this-color "0.2.0"))

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.

(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"

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.

(ntc-shade-this-color "#f3f3f3")      ; "White"
(ntc-shade-this-color "white")        ; "White"
(ntc-shade-this-color "#0c0000")      ; "Red"
(ntc-shade-this-color "ff12ec")       ; "Violet"

Changelist

0.2.0

0.1.0

  • Initial code drop

About

Match RGB codes (color codes, HTML colors) to names easily and precisely.

Resources

License

Stars

Watchers

Forks

Packages

No packages published