Read more

Sass: Use black or white foreground color depending on the lightness of the background

Henning Koch
March 07, 2012Software engineer at makandra GmbH

This article shows how to create a Sass mixin for a colored button. The button's foreground color is dynamically chosen between either black or white, depending on the given background color.

Illustration money motivation

Opscomplete powered by makandra brand

Save money by migrating from AWS to our fully managed hosting in Germany.

  • Trusted by over 100 customers
  • Ready to use with Ruby, Node.js, PHP
  • Proactive management by operations experts
Read more Show archive.org snapshot

It's a nice intro into @if and @else conditionals in Sass.

Posted by Henning Koch to makandra dev (2012-03-07 22:24)