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.

You need 4 colors

180 pointsby s4i5 months ago

27 comments

latexr5 months ago
This website is the best argument against itself. Every single colour combination was awful, to the point it literally made my eyes hurt, and had so little contrast as to be useless.<p>I’ve seen better designed and clearer websites with two colours.
评论 #42389829 未加载
评论 #42387236 未加载
评论 #42391037 未加载
评论 #42387789 未加载
评论 #42396730 未加载
评论 #42421431 未加载
评论 #42390898 未加载
velcrovan5 months ago
I do a (better-looking, I dare say) version of this on my site <a href="https:&#x2F;&#x2F;joeldueck.com" rel="nofollow">https:&#x2F;&#x2F;joeldueck.com</a> , which changes the color scheme depending on the outside temp. Currently it&#x27;s blue because it&#x27;s a little cold outside. I also have a 1D slider you can play with in the page footer.<p>I have a script [1] grab the local temp and convert that to two hue values, which it stores as CSS variables --base-temp and --accent.<p>Then in my CSS I set colors of various things using hsl() values based on one or the other, e.g.:<p><pre><code> background-color: hsl(var(--base-temp),50%,96%); </code></pre> [1]: <a href="https:&#x2F;&#x2F;joeldueck.com&#x2F;code&#x2F;jdcom&#x2F;file?ci=tip&amp;name=static&#x2F;res&#x2F;windfinger.js&amp;ln=5-9" rel="nofollow">https:&#x2F;&#x2F;joeldueck.com&#x2F;code&#x2F;jdcom&#x2F;file?ci=tip&amp;name=static&#x2F;res...</a>
评论 #42391019 未加载
评论 #42402216 未加载
mxfh5 months ago
Rotating hues in HSL is a start, but not something that yields consistent or equivalent results for every imaginable combination.<p>See the HSL .vs OKLCH plots here; <a href="https:&#x2F;&#x2F;evilmartians.com&#x2F;chronicles&#x2F;oklch-in-css-why-quit-rgb-hsl" rel="nofollow">https:&#x2F;&#x2F;evilmartians.com&#x2F;chronicles&#x2F;oklch-in-css-why-quit-rg...</a><p>That&#x27;s even before going into accessibility considerations with safeguarding the sets for common types of color vision deficiencies.<p>Also I only clicked, because I thought it was some kind of demo on the <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Four_color_theorem" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Four_color_theorem</a>
drpossum5 months ago
This is a really gross oversimplification of design principals that ventures into &quot;not even wrong&quot;.<p>It makes a statement that you need four colors (as if you couldn&#x27;t possibly make a usable site with more or less) and then locks you into a 1D slider. That slider gives you four colors without much explanation on that page itself on why this particular algorithm is useful as if this solves some general problem.
评论 #42396522 未加载
gradstudent5 months ago
I count 8 colours on this website. The 4 mentioned, plus: white (appearing in the hue slider), light-pink (background of code box) and two types of gray (appearing in the up&#x2F;down widget)<p>Something something glass houses?
评论 #42388758 未加载
评论 #42387971 未加载
cluckindan5 months ago
You need more when you have more functionalities. Destructive actions, errors, warnings, active&#x2F;focus-hover&#x2F;disabled states, etc.<p>Imagine operating industrial machinery where the ”self-destruct and kill everyone” buttons are the same color, shape and position as the ”shut down safely” button.
评论 #42386868 未加载
评论 #42386856 未加载
Vampiero5 months ago
Maybe some prettier ones though. Crusty vomit green on skin rash pink is not my ideal for a webpage
评论 #42386795 未加载
Night_Thastus5 months ago
I am not a website designer, nor do I do much UX.<p>However, I definitely disagree with at the very least the implementation here.<p>To me, the background can&#x27;t be some significantly saturated color. It has to be <i>very</i> muted. Otherwise my brain says something is wrong with it. The only combinations I found more tolerable were those where the background became a near-grey and the color was limited to the elements. It&#x27;s just too much. I&#x27;m not sure why, it is just is.<p>And even then, the contrast felt low, like the whole page was &#x27;foggy&#x27; or out of focus.
philippta5 months ago
Refactoring UI suggest you need a wide range of colors:<p><a href="https:&#x2F;&#x2F;www.refactoringui.com&#x2F;previews&#x2F;building-your-color-palette" rel="nofollow">https:&#x2F;&#x2F;www.refactoringui.com&#x2F;previews&#x2F;building-your-color-p...</a>
eadmund5 months ago
I like it. Are these the best palettes ever? No. Are they better than what someone like me would come up with? Yes! Good for the author!
barbequeer5 months ago
105 comments and counting. I think this page was maybe an attempt to troll opinionated HN people
评论 #42399155 未加载
esher5 months ago
In defense of the project I have to say that I like the color naming of &#x27;primary&#x27;, &#x27;secondary&#x27;, &#x27;tertiary&#x27;, plus some &#x27;accent&#x27; color.
评论 #42387285 未加载
vunderba5 months ago
CGA would beg to differ.<p><a href="https:&#x2F;&#x2F;tedium.co&#x2F;2017&#x2F;06&#x2F;15&#x2F;ibm-pc-cga-graphics-cards-legacy&#x2F;" rel="nofollow">https:&#x2F;&#x2F;tedium.co&#x2F;2017&#x2F;06&#x2F;15&#x2F;ibm-pc-cga-graphics-cards-legac...</a>
xwall5 months ago
good but this is already available and a lot better! <a href="https:&#x2F;&#x2F;uicolors.app&#x2F;create" rel="nofollow">https:&#x2F;&#x2F;uicolors.app&#x2F;create</a>
评论 #42387022 未加载
评论 #42390910 未加载
snvzz5 months ago
Amiga understood the concept.<p>Thus workbench was originally 4 color, which did stay as default.<p>Conveiently, at the default hires (640x horiz resolution) 68k cpu would always be able to access chip ram, as the cpu is only able to use half the cycles, and at 4 color the blitter in Agnus uses most of the other half to stream bitplanes to Denise.
oneeyedpigeon5 months ago
I get that the text tries to explain where the 4 colours are used on the page, but I would find it a LOT easier to use if there were a clear &#x27;key&#x27; as well.
rinzero5 months ago
Then the user comes in with DarkReader, Dark Background With Light Text, their browser&#x27;s integrated reader mode, or some other client-side stylesheet override and erases your effort.<p>The site is a good example of aesthetics taking precedent over accessibility. No matter what slider position I chose, I couldn&#x27;t get an eye-friendly hue with good contrast.<p>Then I toggled on DarkReader and immediately got what I needed.
KTibow5 months ago
Also see: Material You<p>With Material 3 they released Material Color Utilities, a library that can generate more complicated color schemes from a source color. It uses a color space that properly accounts for perceived brightness so there&#x27;s some contrast guarantees.
Someone5 months ago
FTA (emphasis added):<p><i>“You need 4 colors<p>2 for text and background(primary &amp; secondary colors). 1 accent color to highlight important elements(number 4 &amp; buttons). And an OPTIONAL tertiary color to add a bit of personality(the hue slider).”</i><p>So, the article contradicts itself, saying that you <i>need</i> 3 colors.<p>Also, highlighting can be done by different means than color. You can use bold text, inverted video, a different font, blinking, more subtle animations, etc.<p>In fact, text and background need not be different colors. Varying brightness can be sufficient.<p>A nice example of all of that is the original Mac. It used two shades of gray (extremely dark aka ‘black’ and extremely light aka ‘white’), but many other monochrome interfaces also showed that two colors suffice.
评论 #42387990 未加载
评论 #42388434 未加载
butz5 months ago
You should add min and max attributes to number input ;)
krsdcbl5 months ago
This is one of my main topics when integrating design systems for UI concerns, and imho this site does well at demonstrating a central problem and misunderstanding:<p>The author talking about &quot;4 colors&quot;, when really he means 4 &quot;color roles&quot; or &quot;theming swatches&quot;.<p>First of all, 4 don&#x27;t cut it.<p>You&#x27;ll need accents for all of them, to fade sidenotes, visual hierarchy and disabled elements; to differentiate states of interactive; for borders, separators, and other parts of the chrome, and visual distinction of illustrative elements like icons; to give just a few samples ..<p>But the shortcomings of building a design system on 3 swatches for &quot;text, bg, button&quot; will become obvious much sooner, since defining which of the text&#x2F;bg colors works for the button text depends on the button color itself, etc.<p>What most frameworks, complex and simplistic alike, get wrong imho, is that you need TWO &quot;layers&quot; of color definition, not to cram your palette definition into semantic concerns of the ui to be decorated. Those are separate concerns!<p>Or better said: the purpose of design tokens is not to be an abstraction for css properties of distinctive components.<p>- One Layer is your brand definition, or the color palettes that will serve to define the GUIs design. These are your design tokens<p>- The other layer is a semantic abstraction of the requirements in the design context. These are your &quot;text, bg, button text, button bg, ...&quot;<p>The library of design tokens need to acommodate ANY context the brand design could be applied to, and thus provide a wide range of shades for whatever amount of base colors want to use in the brand design.<p>These will then be mapped to the second layer of &quot;roles&quot;, and populate whatever distinct use cases in the design.<p>TLDR: there is no &quot;text, bg, highlight&quot; color. There are &quot;primary, secondary, accent, neutral, ...&quot; color palettes, and &quot;copy text, copy bg, button text, button icon, button bg, hovered button, ..&quot; swatches to be populated with them.
评论 #42406278 未加载
评论 #42396466 未加载
red_admiral5 months ago
My terminal needs 8 colors - or more depending on how you count foreground&#x2F;background, normal&#x2F;intense etc.
vardump5 months ago
And those colors are cyan, magenta, white and black?
agos5 months ago
does this pass any contrast check for accessibility?
评论 #42387035 未加载
bryanrasmussen5 months ago
When I saw the title I obviously thought it was going to be about 4 color theorem, so I was disappointed but then I considered...<p>Is there actually a 4 color theorem like rule for text and background colors needed, probably there is a design rule but that isn&#x27;t a mathematical rule the way the 4 color theorem is. And I guess that the rule is just text and background each need a color - so two colors.
lovegrenoble5 months ago
Did not find my favorite combination...
评论 #42386907 未加载
robertoandred5 months ago
&quot;How it works?&quot;<p>Where did this crazy sentence construction come from? I&#x27;m Ron Burgundy?