Live data from Hacker News

Building your color palette

refactoringui.com

11–20 of 118 posts

Re: Building your color palette

#11
post #3

I actually really love that first example. Wish more sites looked like that.

Why the yellow background though? It'd look nicer with the light cyan background. Save the yellow and red for some kind of attention colors.

Even with the "right colors" one can go wrong if the colors are not used in a smart way: green over red or blue over yellow is seldom good for something people are expected to look at longer times.

(Yes, I fully understand the first example was a "don't do this", but it was not the best it could be with those colors)

Re: Building your color palette

#12
Take this one step further and build the color palette into your stylesheets. If you're using Sass you can setup something like:

    $palettes: (
      blue: (
        lightest: hsl(201, 75%, 66%),
        lighter:  hsl(201, 75%, 61%),
        light:    hsl(201, 75%, 56%),
        base:     hsl(201, 75%, 51%),
        dark:     hsl(201, 75%, 46%),
        darker:   hsl(201, 75%, 41%),
        darkest:  hsl(201, 75%, 36%)
      ),
      red: (...),
      gray: (...)
    )

    @function palette($palette, $tone: 'base') {
      @return map-get(map-get($palettes, $palette), $tone);
    }
This ends up looking like: `background-color: palette(blue, "light")` in your codebase.

I typically use hsl instead of hex codes because it is easier to understand and modify. You can quickly build up a palette by just modifying the lightness scale on each color by a constant percentage. (This is where I disagree with the author, all of design is just math)

It is often useful to combine colors for your designs and Sass has you covered with the `mix` function. Using this setup you can call `mix(palette(blue), palette(gray))` to combine colors in your palette. You typically want to do this with text on a colored background to make it look more visually appealing.

This is the only way I've found to stay sane managing your colors in a big project. In my experience, everything else goes off the rails when you introduce multiple people into the picture. Please steal this idea, your projects will be better because of it.

Re: Building your color palette

#13
There actually is a science for this: it's called accessibility. WCAG guidelines would be extremely useful in determining how colors should be combined and applied to meet contrast guidelines.

It would also be useful to create usage contexts to guide additions to the palette. for example: text + background, ui (border, icon) + background, background + background.

These would help identify common situations and ensure that you're adding the colors you need and avoiding future bloat.

Since companies are now being sued over a11y issues, it's definitely something that should be incorporated into the design process from the beginning.

Re: Building your color palette

#14
I've picked my fair share of colors for various businesses, and something that annoys me is that you pretty much always end up with green or blue being the main color.

I tried to figure out why, and I think it's a really dumb reason: like this article says, if you don't really know what you're doing with design, you want a spectrum of light-to-dark colors to choose from. Light green -> normal green -> dark green.

For some weird reason, we call light red "pink". And dark orange/yellow is "brown". If you pick one of those as your main color, it becomes much harder to just use lighter or darker shades without it becoming something else entirely. Great designers can make pink or brown work, but if you're a programmer who's just trying to find a "good enough" color scheme, it's way easier to go with green or blue.

I don't really have a good reason why we all think of pink as a different color from red, but we do.

Re: Building your color palette

#15
post #9

> Ever used one of those fancy color palette generators? You know, the ones where you pick a starting color, tweak some options that probably include some musical jargon like "triad" or "major fourth", and are then bestowed the five perfect color swatches you should use to build your website? > This calculated and scientific approach to picking the perfect color scheme is extremely seductive, but not very useful. Jus…

That might be true but this article basically says you have to rely on your eyes. You might as well get the designer to do everything. We programmers should also publish articles like this: dont even bother with Excel formulas you need a programmer

I didn't want to criticize. My argument was meant to support the thesis that the palette generators are useless. They are not only useless from the designers point of view stated in the article but also from a scientific view.

> You might as well get the designer to do everything. We programmers should also publish articles like this: dont even bother with Excel formulas you need a programmer

I couldn't agree more.

Re: Building your color palette

#16
Awesome blog post, providing interesting approaches.

What I always struggle with is not the different shades, but finding suitable other colors which go along with a given one. Let’s say your company already has a hex code for a blue. How do you find appropriate greens and reds to go along with it?

Re: Building your color palette

#17
post #5

Let's say I created a suitable color palette. What would be the best way to make sure the colors are used consistently? – Giving it names like primary_700 or accent_1_700 seems a bit too technical.

Use a css preprocessor, and define variables with the technical names but classes that end up in html should have descriptive names. Something like this:

  $accent_1_700: #e60000;
  $accent_2_900: #ff9999;

  @mixin button_border($color) {
    border: 1px solid $color;  
  }
  
  .alert-button {
    background-color: $accent_2_900;
    @include button_border($accent_1_700);  
  }
This makes your color palette defined explicitly and easy to change in one place, and makes which color on the palette you're using in a given context defined explicitly as well.

Re: Building your color palette

#18

> Ever used one of those fancy color palette generators? You know, the ones where you pick a starting color, tweak some options that probably include some musical jargon like "triad" or "major fourth", and are then bestowed the five perfect color swatches you should use to build your website? > This calculated and scientific approach to picking the perfect color scheme is extremely seductive, but not very useful. Jus…

Whether you see it as having science behind it or not really depends on what problem you're considering. There are some interesting in-depth articles about how people build those palettes and ramps that you might find interesting: https://uxplanet.org/designing-systematic-colors-b5d2605b15c https://design.lyft.com/re-approaching-color-9e604ba22c88

Thanks for the links, I skimmed the articles, they are very interesting and I will certainly read them later. They are not what I'm looking for, however.

What I'm looking for are empiric, preferably cross-cultural, studies on color harmony. I'm interested in work similar to what has been done for Unique Hues and Focal Colors but for combinations of two or more colors and for the notion whether people find these combinations pleasing, neutral or displeasing. I wouldn't be surprised too much if we couldn't find universal pleasing combinations but I'm surprised that apparently no one has done these type of studies.

Re: Building your color palette

#19
While there are no absolutes when it comes to taste.

One design language that I really like is the Atlassian/Bitbucket one.

https://atlassian.design/guidelines/brand/color-1

I've generally really liked the changes to bitbucket over the last few years in terms of UI and UX.

They also have an impressive component archive.

https://atlaskit.atlassian.com/packages

A lot of the packages are under an Apache 2 license, I can't say all as I haven't looked but the master repo is Apache 2.0 as well.

Post reply on HN