/tints-and-shades

Display tints and shades of a given hex color in 10% increments

Primary LanguageHTML

What is the Tint & Shade Generator?

The purpose of this tool is to accurately produce tints (lighter variants) and shades (darker variants) of a given hex color in 10% increments.

Why is this tool unique?

Testing shows that the color output matches that of the classic W3Schools color picker, the Sass color function, and the PostCSS color-mod function.

The W3Schools color picker no longer shows tints and shades in exact 10% increments from the base color, and most other tools out there get the calculation incorrect due to rounding errors or other inconsistencies.

When would I use this?

It's best used when you already have a base color palette but would like some complimentary colors for gradients, borders, backgrounds, shadows or other elements.

This is useful for designers who may be communicating color intent to developers that use Sass or PostCSS in their builds. It's also a solid way to quickly preview what tints and shades look like for a base color you may be considering for your design.

Why 10% increments?

That’s the standard I developed for my design process at Texas State University and in other projects. I think choosing tints and shades based on a flat percentage is a clean, reproducible way to augment brand palettes and produce designs with depth.

Calculation Method

The given hex color is first converted to RGB. Then each component of the RGB color has the following calculation performed on it, respectively.

  • Tints: New value = current value + ((255 - current value) x tint factor)
  • Shades: New value = current value x shade factor

The new value is rounded if necessary, and then converted back to hex for display.

Example Calculation

Let's say we want tints and shades of Rebecca Purple, #663399.

10% Tint

  1. #663399 is converted to the RGB equivalent of 102, 51, 153
  2. R: 102 + ((255 - 102) x .1) = 117.3, rounded to 117
  3. G: 51 + ((255 - 51) x .1) = 71.4, rounded to 71
  4. B: 153 + ((255 - 153) x .1) = 163.2, rounded to 163
  5. RGB 117, 71, 163 is converted to the hex equivalent of #7547a3

10% Shade

  1. #663399 is converted to the RGB equivalent of 102, 51, 153
  2. R: 102 x .9 = 91.8, rounded to 92
  3. G: 51 x .9 = 45.9, rounded to 46
  4. B: 153 x .9 = 137.7, rounded to 138
  5. RGB 92, 46, 138 is converted to the hex equivalent of #5c2e8a

Attribution

This application is inspired by a similar app once maintained by North Krimsly, with significant modifications made to the calculation method and interface design.

Credits

Michael Edelstone designed and organized it. Nick Wing helped with the JavaScript.

License

Open source; please use. CC BY-SA 3.0 US

Contributing

If you'd like to help improve this tool, feel free to file an issue or make a pull request.

Styles

Resources