Instead of returning the mean rgb values, a better idea is to cluster the colors (e.g. using mean-shift algorithm) in a perceptually uniform color space [2] (such as CIELAB).<p>[1] <a href="https://en.wikipedia.org/wiki/Mean_shift" rel="nofollow">https://en.wikipedia.org/wiki/Mean_shift</a>
[2] <a href="https://programmingdesignsystems.com/color/perceptually-uniform-color-spaces/" rel="nofollow">https://programmingdesignsystems.com/color/perceptually-unif...</a>
Really interesting idea! I was thinking this might be a neat color name-to-rgb tool, but the resulting color deviates substantially from expected colors (which, given the algorithm, is to be expected):<p><a href="https://alexbeals.com/projects/colorize/search.php?q=coral" rel="nofollow">https://alexbeals.com/projects/colorize/search.php?q=coral</a><p><a href="https://alexbeals.com/projects/colorize/search.php?q=goldenrod" rel="nofollow">https://alexbeals.com/projects/colorize/search.php?q=goldenr...</a><p><a href="https://alexbeals.com/projects/colorize/search.php?q=eggplant" rel="nofollow">https://alexbeals.com/projects/colorize/search.php?q=eggplan...</a><p>I don't believe just switching from average to dominant color will actually fix this.<p>(Edit: s/more often wrong than not/<diplomatic verbiage>/)
This is really fun! I started plugging in US states. It makes a pretty interesting palette for the map.<p><a href="https://gist.github.com/riebschlager/2f1a3c0391bc42c9ec9bdc6e46e19ab7" rel="nofollow">https://gist.github.com/riebschlager/2f1a3c0391bc42c9ec9bdc6...</a>
For people who are interested in this kind of idea, there is some research on estimating Word-Color associations.<p>A popular crowd-sourced dataset for this is [1] which contains average color association for 14,000 words. There is a demo available at [2].<p>There's also a recent work[3] trying to estimate such association using image data from Google, similar to the OP project, but a bit more sophisticated than just taking an average.<p>1: Colourful Language: Measuring Word-Colour Associations, Saif Mohammad, ACL 2011 Workshop on Cognitive Modeling and Computational Linguistics (CMCL). <a href="https://www.aclweb.org/anthology/W11-0611/" rel="nofollow">https://www.aclweb.org/anthology/W11-0611/</a><p>2: <a href="http://www.lexichrome.com/" rel="nofollow">http://www.lexichrome.com/</a><p>3: Estimating Color-Concept Associations from Image Statistics. Ragini Rathore et al., IEEE VIS InfoVis 2019. <a href="https://arxiv.org/pdf/1908.00220.pdf" rel="nofollow">https://arxiv.org/pdf/1908.00220.pdf</a>
uh-oh<p><a href="https://alexbeals.com/projects/colorize/search.php?q=human" rel="nofollow">https://alexbeals.com/projects/colorize/search.php?q=human</a>
<a href="https://alexbeals.com/projects/colorize/search.php?q=skin" rel="nofollow">https://alexbeals.com/projects/colorize/search.php?q=skin</a><p>this is crayola-gate all over....
I had so much fun with this. I actually like that it uses the mean rather than some clustered mode in a lot of the cases I tried out. For example, “space” is pleasantly brighter than the dark black/blue hue that would come from that approach. It’s a little warmer and brighter than that, and feels like a truer representation of the concept in my mind’s eye. Obviously it will end up muddy for some things with several dominant colors. The mean approach also allows for some fun experiments like “black and white” which returned a rewardingly exact gray for me. Which led me to “newspaper” which is gray with most weight to the red and some to blue, and looks just right. I just spent about 15 minutes on this. Simple fun and useful, I am totally going to use this for something, thanks!
Not that these do the same thing, but if you'd like, I wrote this proc in tcl/tk a couple of days ago if anyone wants to compare this site to tk's internals.<p><pre><code> proc color_name_to_hex {name} {
set hex "#"
foreach color [winfo rgb . "$name"] {
append hex [string range [format %02x $color] 0 1]
}
return $hex
}</code></pre>
I like this project. It's not accurate[1], but it's still very cool and I don't think there's a great way to make it better without ruining the fun and simplicity.<p>[1] <a href="https://alexbeals.com/projects/colorize/search.php?q=piss" rel="nofollow">https://alexbeals.com/projects/colorize/search.php?q=piss</a>
This is neat, coincidentally I was wondering about a superficially similar problem recently:<p>Given a list of arbitrary strings, generate a consistent mapping from that list to a color palette of distinguishable colors.<p>This is distinct from deterministically mapping a single string to a single color (easy) because the intention is to provide a reasonably distinct set of colors, which I think can't be guaranteed when looking at single values.<p>Bonus: if [str1, str2, str3] -> [rgb1, rgb2, rgb3], have the map update incrementally, so that [str1, str2, str3, str4] -> [rgb1, rgb2, rgb3, rgb4].<p>I assume I'm restating a version of some existing algorithm, but I don't know what.
Searching for "pink" results in a muddy brown:<p><a href="https://alexbeals.com/projects/colorize/search.php?q=pink" rel="nofollow">https://alexbeals.com/projects/colorize/search.php?q=pink</a>
It's a neat idea, but the colors seem off. For example, I search for tomato and I get #DC9385 which is a light rust color(?). Maybe this is just what I think as the color tomato should be is different. I would think a vibrant red. I know tomatoes come in different colors, but to me that is the color that immediately jumps to mind. Cool idea though.
Cool project, but can you add API?<p>I coded this basic python script to show colors in terminal;<p><a href="https://github.com/tuxys/python/blob/main/color.py" rel="nofollow">https://github.com/tuxys/python/blob/main/color.py</a>
I like how the result text switches from white to black depending on the brightness of the selected background color. does anyone know how this is done? I could use this algorithm in other projects
Cool idea, but as expected, any word/phrase that isn't approximately one-to-one with a particular color or region in the color space turns up nearly gray.
This reminds of Randall's xkcd colors[0], who did the reverse experiment: given a color, what would be the most appropriate name? The 954 names made it into Python's matplotlib.<p>[0] <a href="https://blog.xkcd.com/2010/05/03/color-survey-results/" rel="nofollow">https://blog.xkcd.com/2010/05/03/color-survey-results/</a>
Entirely off topic, I know, but the title is one of the few words Canadian English spells uniquely.<p>'Colourize'.<p>In British English: Colourise. American: Colorize.<p>And we're very upset that spell checkers make us choose between only American and British options.
Just for fun, I tried this :-)<p><a href="https://alexbeals.com/projects/colorize/search.php?q=Trump" rel="nofollow">https://alexbeals.com/projects/colorize/search.php?q=Trump</a> (#4F4252)
<a href="https://alexbeals.com/projects/colorize/search.php?q=Biden" rel="nofollow">https://alexbeals.com/projects/colorize/search.php?q=Biden</a> (#433A4A)<p>Colors looks very similar O_o Could this be a sign?
I am reminded of this by some of the seemingly bad results: <a href="https://www.youtube.com/watch?v=wh4aWZRtTwU" rel="nofollow">https://www.youtube.com/watch?v=wh4aWZRtTwU</a>