Color Highlighting for Tailwind CSS Variables in VS Code
Francisco Moretti

Francisco Moretti @franciscomoretti

About: Full Stack Engineer at Samaya AI. I talk about web development, AI, and good programming practices.

Location:
UK
Joined:
Oct 23, 2021

Color Highlighting for Tailwind CSS Variables in VS Code

Publish Date: Jan 3
5 1

When working with Tailwind CSS variables in VS Code, having visual color indicators can significantly improve your development workflow. This is particularly useful when working with Shadcn UI components, which heavily rely on CSS variables for theming.

The Solution

  1. Install the Color Highlight extension by Sergii N from the VS Code Marketplace

  2. Enable HSL color highlighting by adding this to your VS Code settings.json:

{
  "color-highlight.matchHslWithNoFunction": true
}
Enter fullscreen mode Exit fullscreen mode

Result

With this setup, you'll see color indicators next to your Tailwind CSS variables, making it easier to identify and work with colors in your stylesheets, especially when customizing Shadcn UI themes:

Color highlighting in VS Code

This simple configuration works with both standard CSS colors and HSL values, making your Tailwind CSS and Shadcn UI development experience more visual and intuitive.

Comments 1 total

  • tyler36
    tyler36Jan 6, 2025

    Great tip! Thank you.

Add comment