TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Colorize

155 pointsby didizajaover 4 years ago

33 comments

porphyraover 4 years ago
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:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Mean_shift" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Mean_shift</a> [2] <a href="https:&#x2F;&#x2F;programmingdesignsystems.com&#x2F;color&#x2F;perceptually-uniform-color-spaces&#x2F;" rel="nofollow">https:&#x2F;&#x2F;programmingdesignsystems.com&#x2F;color&#x2F;perceptually-unif...</a>
评论 #25829038 未加载
评论 #25830375 未加载
评论 #25830944 未加载
评论 #25828843 未加载
评论 #25830377 未加载
评论 #25833399 未加载
mceachenover 4 years ago
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:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=coral" rel="nofollow">https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=coral</a><p><a href="https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=goldenrod" rel="nofollow">https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=goldenr...</a><p><a href="https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=eggplant" rel="nofollow">https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=eggplan...</a><p>I don&#x27;t believe just switching from average to dominant color will actually fix this.<p>(Edit: s&#x2F;more often wrong than not&#x2F;&lt;diplomatic verbiage&gt;&#x2F;)
评论 #25829066 未加载
评论 #25829096 未加载
评论 #25828994 未加载
评论 #25829040 未加载
riebschlagerover 4 years ago
This is really fun! I started plugging in US states. It makes a pretty interesting palette for the map.<p><a href="https:&#x2F;&#x2F;gist.github.com&#x2F;riebschlager&#x2F;2f1a3c0391bc42c9ec9bdc6e46e19ab7" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;riebschlager&#x2F;2f1a3c0391bc42c9ec9bdc6...</a>
mkasuover 4 years ago
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&#x27;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:&#x2F;&#x2F;www.aclweb.org&#x2F;anthology&#x2F;W11-0611&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.aclweb.org&#x2F;anthology&#x2F;W11-0611&#x2F;</a><p>2: <a href="http:&#x2F;&#x2F;www.lexichrome.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.lexichrome.com&#x2F;</a><p>3: Estimating Color-Concept Associations from Image Statistics. Ragini Rathore et al., IEEE VIS InfoVis 2019. <a href="https:&#x2F;&#x2F;arxiv.org&#x2F;pdf&#x2F;1908.00220.pdf" rel="nofollow">https:&#x2F;&#x2F;arxiv.org&#x2F;pdf&#x2F;1908.00220.pdf</a>
majewskyover 4 years ago
&quot;Truth&quot; gives me a nearly perfect 50% gray, which is kind of beautiful when you think about it.
makachover 4 years ago
uh-oh<p><a href="https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=human" rel="nofollow">https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=human</a> <a href="https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=skin" rel="nofollow">https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=skin</a><p>this is crayola-gate all over....
评论 #25833916 未加载
loklover 4 years ago
Watermelon.<p>&quot;Average color&quot; is not really what I want.
评论 #25828773 未加载
评论 #25828621 未加载
评论 #25828701 未加载
khinerover 4 years ago
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&#x2F;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!
Karawebnetworkover 4 years ago
Good idea, except I&#x27;m getting shades of brown for almost all queries.
评论 #25830518 未加载
monetusover 4 years ago
Not that these do the same thing, but if you&#x27;d like, I wrote this proc in tcl&#x2F;tk a couple of days ago if anyone wants to compare this site to tk&#x27;s internals.<p><pre><code> proc color_name_to_hex {name} { set hex &quot;#&quot; foreach color [winfo rgb . &quot;$name&quot;] { append hex [string range [format %02x $color] 0 1] } return $hex }</code></pre>
modover 4 years ago
I like this project. It&#x27;s not accurate[1], but it&#x27;s still very cool and I don&#x27;t think there&#x27;s a great way to make it better without ruining the fun and simplicity.<p>[1] <a href="https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=piss" rel="nofollow">https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=piss</a>
评论 #25828743 未加载
评论 #25831325 未加载
alanbernsteinover 4 years ago
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&#x27;t be guaranteed when looking at single values.<p>Bonus: if [str1, str2, str3] -&gt; [rgb1, rgb2, rgb3], have the map update incrementally, so that [str1, str2, str3, str4] -&gt; [rgb1, rgb2, rgb3, rgb4].<p>I assume I&#x27;m restating a version of some existing algorithm, but I don&#x27;t know what.
Svetlitskiover 4 years ago
Searching for &quot;pink&quot; results in a muddy brown:<p><a href="https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=pink" rel="nofollow">https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=pink</a>
echelonover 4 years ago
&quot;Hacker News&quot;:<p><a href="https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=Hacker+news" rel="nofollow">https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=Hacker+...</a><p>Not bad!
kemiller2002over 4 years ago
It&#x27;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.
评论 #25833994 未加载
tuxover 4 years ago
Cool project, but can you add API?<p>I coded this basic python script to show colors in terminal;<p><a href="https:&#x2F;&#x2F;github.com&#x2F;tuxys&#x2F;python&#x2F;blob&#x2F;main&#x2F;color.py" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tuxys&#x2F;python&#x2F;blob&#x2F;main&#x2F;color.py</a>
Biganonover 4 years ago
Funnily enough, the word &quot;BA0BAB&quot; returns #B688AB, close to #BA0BAB but not exactly it
swyxover 4 years ago
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
评论 #25832755 未加载
anonytraryover 4 years ago
Cool idea, but as expected, any word&#x2F;phrase that isn&#x27;t approximately one-to-one with a particular color or region in the color space turns up nearly gray.
winridover 4 years ago
You could probably improve the accuracy a lot by ignoring some percentage of the edge of images, to help eliminate averaging the backgrounds.
adontzover 4 years ago
Colors of Python and C++ are more pleasant to me, than colors of C# and Java. Oh, that&#x27;s why, I guess :-D
winridover 4 years ago
All the vehicle manufacturers I tried gave varying shades of &quot;grey&quot;.<p>Fire is also not what I expected :)
swyxover 4 years ago
decidedly not yellow <a href="https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=yellow+submarine" rel="nofollow">https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=yellow+...</a>
thecellardoorover 4 years ago
This is oddly addictive. Just typing in stuff and see what colors it gives me :)
评论 #25833742 未加载
jhnclsover 4 years ago
This reminds of Randall&#x27;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&#x27;s matplotlib.<p>[0] <a href="https:&#x2F;&#x2F;blog.xkcd.com&#x2F;2010&#x2F;05&#x2F;03&#x2F;color-survey-results&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.xkcd.com&#x2F;2010&#x2F;05&#x2F;03&#x2F;color-survey-results&#x2F;</a>
sombremesaover 4 years ago
I wish this wouldn&#x27;t take over my browser history like that.
neilsenseover 4 years ago
&quot;indian&quot; is...<p><a href="https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=indian" rel="nofollow">https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=indian</a>
评论 #25831353 未加载
mabboover 4 years ago
Entirely off topic, I know, but the title is one of the few words Canadian English spells uniquely.<p>&#x27;Colourize&#x27;.<p>In British English: Colourise. American: Colorize.<p>And we&#x27;re very upset that spell checkers make us choose between only American and British options.
评论 #25829668 未加载
azinman2over 4 years ago
&quot;pink&quot; seems to fail miserably.
inullover 4 years ago
Just for fun, I tried this :-)<p><a href="https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=Trump" rel="nofollow">https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=Trump</a> (#4F4252) <a href="https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=Biden" rel="nofollow">https:&#x2F;&#x2F;alexbeals.com&#x2F;projects&#x2F;colorize&#x2F;search.php?q=Biden</a> (#433A4A)<p>Colors looks very similar O_o Could this be a sign?
p1neconeover 4 years ago
I am reminded of this by some of the seemingly bad results: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=wh4aWZRtTwU" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=wh4aWZRtTwU</a>
antattackover 4 years ago
Hmm...<p>Socialist: pinkish Communist: bright red Capitalist: light brown Fascist: dark brown
sodapopcanover 4 years ago
Neat!<p>It would be a nicer experience if search bar would autofocus.