I want to tag color names based on hex or rgb values. I found this amazing site ( http://www.color-blindness.com/color-name-hue/ ) but the thing is there are so many color names and main color hues are insufficient. I would love to have a solution to name RGB or HEX for like 40-50 well known colors.
Any idea will help me, thank you
This one will be useful, you will have to parse this json to use it in your project.
I wrote a command-line tool that does exactly that: Cict
Example:
$ ./cict 000081
1 #000080 navyblue
As you can see, you simple pass a 24-bit hex-value to cict and it reports the distance to the color found (1 in this case), the value of the actual color (#000080) and the name (navyblue).
Related
I'm trying to find an automated way to calculate what DMC color is closest to a given RGB. I found this site:
http://www.damaniel.info/dmc/dmctorgb.html
And that does what I want. However, I have to type each RGB is separately and I have a lot of them.
I'd like to use formulas to automate the calculate. Preferably in Excel or in R. I haven't had luck with Selenium (and don't have much spare time right now to get up to speed), so that might not be the best option for doing automated form filling with the above site.
Any ideas?
The DMC R package (1) will help with that. It looks like it only supports hexadecimal codes, but you can convert RGB colors using the rgb function from the grDevices package (Use maxColorValue = 255 if you are using RGB versus rgb).
# install.packages("devtools")
# devtools::install_github("sharlagelfand/dmc")
library(dmc)
# convert rbg to hex
# second green color from ColorBrewer.org
# (3-class BuGn second color)
color <- grDevices::rgb(red = 153, green = 216, blue = 201, maxColorValue = 255)
# find dmc - return a few more results
color_dmc <- dmc(color, n = 3)
color_dmc
If you have a few colors, you can wrap this in a loop or apply function and write the dmc values to a master object by extracting the elements you need (i.e., color_dmc$hex, color_dmc$name, etc.)
1 https://github.com/sharlagelfand/dmc
There's a list of RGB values corresponding to DMC floss colors here: http://my.crazyartzone.com/dmc.asp . There's also a list built in to the source code for the web page you found (and it's different). You can see that list at this URL: http://www.damaniel.info/dmc/dmctorgb.js .
Why are they different? There are different standards for RGB. The most common one is now called sRGB (for "Standard RGB"). They might be using different standards. Or maybe they are getting their colors from different sources. They are approximate, anyway: floss varies in color. So just pick one.
Then what you would need to do is to take your RGB value and find the nearest value in one of those lists.
This isn't trivial, because defining "nearest" is hard. What that web page appears to do is to use Euclidean distance in RGB space, but that space is far from perceptually uniform. So it's probably best to convert both your input RGB color and the table of floss colors to some other representation where equal distances are perceptually equal. I think the LAB space (see ?colorspace::LAB) is probably a good choice for that, but I don't know if it's best. Read http://colorspace.r-forge.r-project.org/articles/color_spaces.html if you want to dig into the details.
So here's what you need to do:
Load a version of one of those tables into a dataframe.
Convert all the RGB values there into LAB values, and add those to the dataframe.
Write a function to convert your input RGB value to LAB.
Find the nearest LAB entry in the dataframe to the LAB value you want, and output the corresponding floss number.
EDITED TO ADD: While I was writing that, #dcruvolo pointed out the nice dmc package. So use that! (Maybe you want to change how it does distance; you really don't want the default Euclidean distance in RGB space.)
What's the easiest way to turn a CSS color string like "orange" or "#def" or "#123456" into a Racket color% object, do some manipulations to the color object, and turn the result back into a CSS color string?
CSS color string can be looked up using color-database. AFAIK, there's no built-in support for converting hex color to color%.
If you are willing to install packages, however, you can use string->color% and hex-triplet->color% from Pict Abbrevs package.
Once you have a color% object, you can query for RGB components, so converting back to hex color should be easy. I don't know a good way to convert back to CSS color string besides creating an inverse map of the color database manually.
Note that there's also CSS tools, but it's unstable and doesn't use color%.
Color properties in CSS can accept color names ( white, pink, etc) or hexadecimal values ( #FFF , #669966 , etc) or RGB.
But not all the color names are standard for all browsers. There are tests like CSS color names vs hex codes, (my results is better hexadecimal) , so is it always better to use hexadecimal than other two options?
Edit: Other duplicate questions is about personal preferences, this is about performance.
Putting away the color names, the hex values and RGB are pretty much the same.
But the result shows that Hex codes are slightly faster (not that much to worry about).
For example, Firefox 11 does 15,400 operations of hex code but 14,900 of rgb in a second.
So, that is not much to worry about. You won't even notice that.
You have sort of already answered your own question... "Not all color names are standard." It is best to get used to use the 6 character hex codes for color. It is explicit and there is no confusion. I have seen some versions of IE mess up with 3 digit hex codes also.
Hex codes are also better because there are many tools like Classic Color Meter, etc which will tell you the hex color value of something your mouse is rolling over.
I'm learning bootstrap from twitter, I want to do some color changes, and I got this color code: #08c
I want to know if it represent #0088cc (and same way for other variations?)
and how is it called so I can find some online color palette.
I thank your help in advance
Yes #08c is equivalent to #0088cc.
Not all colors have names. This one in particular does not.
For a list of all named colors defined in css3 see the spec
From the spec
The format of an RGB value in hexadecimal notation is a ‘#’
immediately followed by either three or six hexadecimal characters.
The three-digit RGB notation (#rgb) is converted into six-digit form
(#rrggbb) by replicating digits, not by adding zeros. For example,
#fb0 expands to #ffbb00. This ensures that white (#ffffff) can be specified with the short notation (#fff) and removes any dependencies
on the color depth of the display.
I use this site
http://www.2createawebsite.com/build/hex-colors.html
to generate color codes for my colors. #08c is not a full representation but it could mean #00008c.
If I see a particular shade of red on a website, how do I find out what the same shade will be in a different color? Example in Green or such?
To see the same shade (saturation and brilliance) in different hues, convert the color to HSV or HSB, and then increment/decrement the Hue value.
This web page describes how to convert RGB to HSV, and even includes sample C code.
http://en.literateprograms.org/RGB_to_HSV_color_space_conversion_%28C%29
...Though you might find more useful algorithms/snippets on the web.
http://www.google.com/search?q=Convert+RGB+to+HSV