Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  6] [ 6]  / answers: 1 / hits: 26678  / 13 Years ago, fri, february 10, 2012, 12:00:00

How can I get a color name using JS/JQuery, knowing the code RBG/HEX?



For example:



Colorname      RGB
black #000000
white #FFFFFF
red #FF0000
green #008000

More From » jquery

 Answers
15

You can use Name that Color.


Example:


let result = ntc.name('#6195ed');

let rgb_value = result[0]; // #6495ed : RGB value of closest match
let specific_name = result[1]; // Cornflower Blue : Color name of closest match
let is_exact_match = result[2]; // false : True if exact color match



There is also a variation of Name that Color that includes additional parameters:


http://www.color-blindness.com/color-name-hue-tool/js/ntc.js


Example:


let result = ntc.name('#6195ed');

let rgb_value = result[0]; // #6495ed : RGB value of closest match
let specific_name = result[1]; // Cornflower Blue : Color name of closest match
let shade_value = result[2]; // #0000ff : RGB value of shade of closest match
let shade_name = result[3]; // Blue : Color name of shade of closest match
let is_exact_match = result[4]; // false : True if exact color match

[#87558] Wednesday, February 8, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
micayla

Total Points: 148
Total Questions: 92
Total Answers: 109

Location: Aruba
Member since Sat, Oct 2, 2021
3 Years ago
micayla questions
Fri, Dec 24, 21, 00:00, 2 Years ago
Thu, Apr 16, 20, 00:00, 4 Years ago
Thu, Nov 14, 19, 00:00, 5 Years ago
;