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.

Practical Color Theory for People Who Code

491 pointsby donnemartinabout 8 years ago

11 comments

justinpombrioabout 8 years ago
If you want to do something meaningful with colors, don&#x27;t use RGB, and don&#x27;t use HSL (which is based on RGB). These spaces are problematic. For instance, pure blue and pure green in RGB space have very different lightness. Here&#x27;s a picture of the region of colors covered by RGB:<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;HSL_and_HSV#&#x2F;media&#x2F;File:Srgb-in-cielab.png" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;HSL_and_HSV#&#x2F;media&#x2F;File:Srgb-i...</a><p>If RGB space corresponded to what our eyes saw, that would be a perfect hexagon. It isn&#x27;t. It&#x27;s warped, and the warping isn&#x27;t subtle.<p>Use CIELAB. CIELAB is designed to match what our eyes see.<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Lab_color_space" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Lab_color_space</a><p>In a little more detail, distances in the CIELAB colorspace approximate perceptual distance (how different two colors look). Distances in the RGB colorspace do not.
评论 #13882338 未加载
评论 #13883881 未加载
评论 #13882964 未加载
评论 #13885786 未加载
评论 #13882653 未加载
评论 #13886022 未加载
评论 #13889986 未加载
b3rryabout 8 years ago
This is pretty flawed. First off, never, ever use complementary colors as the foundation for your design. A red green color scheme (for example) will produce a result that &quot;vibrates.&quot; Open your image editor of choice and look at green text (#00FF00) on a red background (#FF0000). Illegible. Painful to the eye. Don&#x27;t do it. Read more here: <a href="https:&#x2F;&#x2F;webdesign.tutsplus.com&#x2F;articles&#x2F;why-you-should-avoid-vibrating-color-combinations--cms-25621" rel="nofollow">https:&#x2F;&#x2F;webdesign.tutsplus.com&#x2F;articles&#x2F;why-you-should-avoid...</a><p>Secondly, rotating around HSL will not produce true complementary colors. Quick: what are the primary colors? Red, Yellow, and Blue. Here is where the problem lies; In an HSL rotation the primaries occupy the following H values: red (0°), yellow (60°), and blue (240°). These colors are not equidistant. The opposite of red SHOULD be pure green, yet 0°+(360&#x2F;2)=180° which is #00FFFF (blue-green). The opposite of yellow SHOULD be pure purple, yet 60°+(360&#x2F;2)=240° which is #0000FF (pure blue). Which means... you guessed it: the opposite of blue SHOULD be orange, but (240°+(360&#x2F;2))%360)=60° which is #FFFF00 (yellow).<p>This is because color theory is based on pigmented color. ALL of the most common color models used are equidistant between the Red Green Blue values when rotated, instead of the Red Yellow Blue values.<p>No calculation will produce harmonious color schemes. Color theory, like any &quot;creative&quot; skill, is something you can hone through practice and experimentation. There is no formulaic solution.<p>Tl;dr: light and pigment do not have the same &quot;primary&quot; colors. Color theory is based on pigmented colors. RGB, HSB&#x2F;HSL, etc do not allow for equal transformations between RYB, so you cannot use them to calculate accurate complements.
评论 #13882960 未加载
评论 #13886234 未加载
评论 #13883947 未加载
评论 #13884279 未加载
评论 #13884236 未加载
评论 #13884173 未加载
BadassFractalabout 8 years ago
Do you guys know of any solid guides on how to use and mix and match colors in photography and video making to evoke certain specific emotions? It&#x27;s easy to find materials on entry level color theory &quot;here are complementary colors, here is a triad etc&quot; but I haven&#x27;t been able to find a good resource on how to use those coloring choices to influence viewer reactions. Seems like something everybody in the visual arts eventually has to master but also seems very undocumented, like a black art.
评论 #13881452 未加载
评论 #13881497 未加载
评论 #13882337 未加载
评论 #13882225 未加载
评论 #13882311 未加载
评论 #13884523 未加载
评论 #13882525 未加载
评论 #13882033 未加载
评论 #13881892 未加载
spoilerabout 8 years ago
She makes excellent points in the text, but then uses less-than-optimal colours to back up her points. There is also much, much more to colour theory than what is outlined in this nice example.<p>And as others pointed out HSL&#x2F;RGB are not the best (or easiest) to do heavy colour-theory based deesigns. If you&#x27;re serious about colour theory in design, use CIE L<i>a</i>b* or Munsell
jacobolusabout 8 years ago
Ugh. This is well meaning, but because based on a color model with a very tenuous relation to human color perception, with further decisions built on loose heuristics without rigorous support (and apparently ported from paint mixing advice), the choices made are pretty arbitrary, yielding poor results.<p>This part in particular ...<p>&gt; <i>Pick any color by selecting its hue (0-360) on the color wheel at full saturation (100%) and at half lightness (50%) - this way you start with the &#x27;most colorful color&#x27; you can get. ¶ Generate your second color without having to guess what will work. Thanks to science and wavelengths, we know that this works. The opposition of these two colors stimulate your photoreceptor cells in a good way!</i><p>... ends up being poor advice in general, “science and wavelengths” notwithstanding. Any pair of decently separated hues will do just as well as a pair of HSL “complements”, as long as the chroma and lightness are carefully chosen. If you take this specific advice and just rotate the hue around in HSL space, all of the perceptual color relationships will swing wildly.<p>Someone following this program who has a lot of experience with visual art &#x2F; design will end up making reasonable choices based on intuition and past experience, but that will be in spite of this guide, not because of it.<p>Sorry to be harsh, but in my opinion non-experts will get better results than this blog post’s recommendations by just choosing perceptual lightness (e.g. in CIELAB space) of each color to have sufficient contrast, and then picking the hue&#x2F;chroma entirely at random, or using any other desired criteria.<p>Here’s what Cynthia Brewer, expert in color choices for maps and diagrams, had to say about models like HSL and HSV:<p>&gt; <i>Computer science offers a few poorer cousins to these perceptual spaces that may also turn up in your software interface, such as HSV and HLS. They are easy mathematical transformations of RGB, and they seem to be perceptual systems because they make use of the hue–lightness&#x2F;value–saturation terminology. But take a close look; don’t be fooled. Perceptual color dimensions are poorly scaled by the color specifications that are provided in these and some other systems. For example, saturation and lightness are confounded, so a saturation scale may also contain a wide range of lightnesses (for example, it may progress from white to green which is a combination of both lightness and saturation). Likewise, hue and lightness are confounded so, for example, a saturated yellow and saturated blue may be designated as the same ‘lightness’ but have wide differences in perceived lightness. These flaws make the systems difficult to use to control the look of a color scheme in a systematic manner. If much tweaking is required to achieve the desired effect, the system offers little benefit over grappling with raw specifications in RGB or CMY.</i><p><a href="http:&#x2F;&#x2F;www.personal.psu.edu&#x2F;cab38&#x2F;ColorSch&#x2F;ASApaper.html" rel="nofollow">http:&#x2F;&#x2F;www.personal.psu.edu&#x2F;cab38&#x2F;ColorSch&#x2F;ASApaper.html</a><p>If anyone is looking for a better resource, the best one I know of on the web is <a href="http:&#x2F;&#x2F;www.handprint.com&#x2F;LS&#x2F;CVS&#x2F;color.html" rel="nofollow">http:&#x2F;&#x2F;www.handprint.com&#x2F;LS&#x2F;CVS&#x2F;color.html</a>. Otherwise, I recommend going straight to books. There are a variety of available books at every level of technical detail.
评论 #13881650 未加载
评论 #13886307 未加载
评论 #13883648 未加载
kybernetykabout 8 years ago
That&#x27;s really handy (especially for someone who&#x27;s as aesthetically challenged as me) - but it would be nice what mix() actually does&#x2F;means.<p>I mean it seems to be a handy sass built-in(?) but it would be nice for us who are not webdevs to know how to manually &quot;mix&quot; HSL colors to get the same results.
评论 #13884115 未加载
Razenganabout 8 years ago
I really wish color-related talks and tools would upgrade to wider-than-sRGB color gamuts, now that many modern devices can display them.
评论 #13881924 未加载
737013about 8 years ago
What I found really useful about this was how the presentation laid it out in a way where I could really understand it. For the first time, I got a simple set of concepts behind choosing colors. Without going back to the article, just what I remembered:<p>1) Choose complements. 2) Mix them with each other until they dull down a bit 3) Make some other neutral color ( possibly by mixing them in equal parts ? ) and then you have 3 colors, and you&#x27;ve got a basis.<p>( OK -- just considering is there any connection between color theory and the basis of a vector field? )<p>So what I liked about this was it taught me something I didn&#x27;t know.<p>I accept there are a lot of comments by experts on here about how this simplified presentation is wrong in such and such a way. I don&#x27;t think that decreases its utility for me.<p>To a novice, just having something tangible to understand is the first step. I understand how to experts, it seems like the wrong advice. But I felt I understood it, and that&#x27;s invaluable.<p>If you don&#x27;t know what I mean by this, maybe it&#x27;s better explained by something a professor said to me in grad school, &quot;The trick to teaching is to trick people into thinking they understand it. Don&#x27;t show them all the complexity. Show them a simplified model. Let them come to it in stages.&quot;<p>I think that&#x27;s true. It stuck with me and it seems true. It also matches what I see my science education was like looking back -- a presentation of a series of models, over a number of years, that gradually layered in more and more complexity, but at a pace that was comfortable. This &quot;chain of models&quot; mostly agreed with each other, but the points where they contradicted each other didn&#x27;t to my memory negatively impact learning, instead they served as signposts that made each model more distinct and aided in remembering them.<p>Also, there is this great feeling of being able to say, &quot;Yes from the perspective of model X that is true, but when you factor in what model Y says, you get a different picture. Here, let me show you.&quot; That always sounds like a true expert. I like that and it also seems like having a bunch of models, not all in perfect agreement, in fact strengthened by the points where they do differ, gives overall a far richer picture of the topic.<p>The strongest idea that stayed with me from my science education was that &quot;everything is a model&quot; and &quot;none of them are true&quot; but some of them are useful. Different models, with different levels of faithfulness to evidence.<p>My main critique of what I will label the &quot;dismissive expert answers&quot; is that they posit a inflexible model of the &quot;absolute truth&quot;, which, I say is, given by itself: not that useful ( at least to learn the topic ), and not really true ( because well, no model can be ).<p>I am sorry if this length comment is more suited as a blog post. Maybe I should just make blog posts instead of comments and link to the article. Maybe that&#x27;s better than anyone. I&#x27;m not trying to offend any experts or do anything ego based, just push back against the what I feel were dismissive answers that missed another side of the value of this article. I wanted to share what I thought that other side of the value of this article was.<p>It does seem like a highly personal comment, just from my point of view. I hope it&#x27;s been useful to some others to read it!
评论 #13888340 未加载
k__about 8 years ago
What helped me greatly was using HSL instead of RGB&#x2F;Hex.<p>Get a base color you like and simply change saturation and lightness to get all your other colors.
gibbitzabout 8 years ago
Finally put this &quot;out there&quot;. Nice to see it on HN, says the guy from the meetup who can mix Hex colors in his head.
simoooooabout 8 years ago
hmmm I don&#x27;t like any of the colour examples on this site.<p>Just go to dribbble.com and see what you can see there, many interesting colour themes