2026 Community Survey results are here! See how the Craft CMS community works. results are live!

Using contrast-color (follow-up!)

Two years ago I published a lesson here on CraftQuest about a very specific problem: the topic pills on our own listing pages. Every topic had a color picked in a Craft color field, the text sat on top of it, and some picks, that yellow, left the label unreadable. The fix back then was to pull the color's luma value out of Craft's color field and run it through a `calc()` trick that slammed the text to black or white. It worked. It was clever. You can delete all of it. Here's what replaces it, and it's one line.

Two years ago I pub­lished a les­son here on CraftQuest about a very spe­cif­ic prob­lem: the top­ic pills on our own list­ing pages. Every top­ic had a col­or picked in a Craft col­or field, the text sat on top of it, and some picks, that yel­low, left the label unread­able. The fix back then was to pull the color’s luma val­ue out of Craft’s col­or field and run it through a calc() trick that slammed the text to black or white. It worked. It was clever. You can delete all of it. Here’s what replaces it, and it’s one line.

Transcript

Premium

Follow along with the full transcript

Search every word, click any line to jump to that moment, and read along as you watch — a CraftQuest Premium feature.

Sign up for Premium
Craft Version
Craft 4, Craft 5, Craft 6
Topic
Instructor
Date Published
July 15, 2026

Some stuff to help you along during the lesson: