2023-10-25
3257
#accessibility#css#vanilla javascript
Cristian Diaz
180080
107
Oct 25, 2023 ⋅ 11 min read

Creating contrast themes with CSS prefers-contrast and JavaScript

Cristian Diaz Cristian is a frontend developer from Colombia. He enjoys writing about what he learns and is focusing his career on helping to make web content more accessible to everyone. His main areas of expertise are HTML, CSS, and web accessibility. You can reach Cristian on Bluesky: https://bsky.app/profile/itscrisdiaz.com.

Recent posts:

open ai agent kit

I tried OpenAI’s AgentKit: Does it make Zapier and n8n obsolete?

Examine AgentKit, Open AI’s new tool for building agents. Conduct a side-by-side comparison with n8n by building AI agents with each tool.

Clara Ekekenta
Nov 4, 2025 ⋅ 11 min read

A Jarvis for everyone: AI agents as new interfaces

AI agents powered by MCP are redefining interfaces, shifting from clicks to intelligent, context-aware conversations.

Peter Aideloje
Nov 4, 2025 ⋅ 10 min read
Why Frontend Devs Should Care About Platform Engineering

Why frontend devs should care about platform engineering

Learn how platform engineering helps frontend teams streamline workflows with Backstage, automating builds, documentation, and project management.

Muhammed Ali
Nov 3, 2025 ⋅ 6 min read
vercel ai elements featured image

How I built an AI productivity assistant with Vercel AI Elements

Build an AI assistant with Vercel AI Elements, which provides pre-built React components specifically designed for AI applications.

Emmanuel John
Nov 3, 2025 ⋅ 9 min read
View all posts

One Reply to "Creating contrast themes with CSS prefers-contrast and JavaScript"

  1. Hi Cristian, thanks for your interesting article. You write that the media query “prefers-contrast” is quite young. This fact means that this media query still has room for improvement. For example, this media query does not take into account that there are both light and dark contrast designs (Windows 11: “Desert” and “Night sky”). It would therefore be better if the media query distinguished between a light and a dark contrast design: “prefers-more-contrast: dark” and “prefers-more-contrast: light”. This proposed solution follows the “prefers-color-scheme” logic. I’m not a fan of too much JavaScript because the complexity and therefore the maintenance effort for a website increases very quickly. Are you aware of any ongoing discussions on this topic? If so, where can I find them?

Leave a Reply

Would you be interested in joining LogRocket's developer community?

Join LogRocket’s Content Advisory Board. You’ll help inform the type of content we create and get access to exclusive meetups, social accreditation, and swag.

Sign up now