Last updated: Apr 6, 2024
Reading time·3 min
VS Code has a built-in color picker that is shown in CSS and HTML files.
You have to hover over the color with your mouse for the color picker to show up.
Here is a short clip that demonstrates how to use the color picker in a CSS file.
You can also use the color picker in HTML files.
You can click on the header to change the format of the color between:
If you can't get the color pick to show up in CSS and HTML files:
Ctrl
+ Shift
+ P
on Windows and Linux.Command
+ Shift
+ P
on macOS.F1
to open the Command Palette.The Color Decorators setting controls whether the editor renders the inline color decorators and color pickers.
If the setting is disabled, the color picker is not shown at all.
Note that there is also an Editor: Color Decorators Limit setting.
The setting controls the maximum number of color decorators that are rendered in an editor at once.
The default value is 500 but you can increase it if you work with large files often.
If you notice that color decorators are not shown for some colors, then you are running over the limit.
If you often work with CSS files, you should check out the Color Highlight extension.
Ctrl
+ Shift
+ X
on Windows or Linux.Command
+ Shift
+ X
on macOS.If you open a CSS file, you'll notice that your colors are styled in an easier to notice way.
This helps when looking for specific colors in large CSS files.
The extension also works for HTML files.
You can also change the extension's settings and how colors are displayed:
Ctrl
+ Shift
+ P
(or Command
+ Shift
+ P
on macOS).F1
to open the Command Palette.You can also open the settings screen by pressing Ctrl
+ ,
on Windows and
Linux or Cmd
+ ,
on macOS.
For example, you can set the marker type to outline.
There is also an underline
value.
By default, the colors are also shown in the sidebar.
If you want to disable this behavior, search for color highlight mark in your settings and disable the Color-highlight: Mark Ruler setting.
You can learn more about the related topics by checking out the following tutorials: