Visual Studio Code extension that provides quick information css colors.
Color Info adds additional information when you hover over a css color, including:
rgb
– RGB color values. Enabled by defaulthsl
– HSL color values. Enabled by defaultcss-color-name
- Name of the color (red
,blue
, ...).hsv
– HSV color valueslab
– LAB color valueslch
– LCHab color valuescmyk
– CMYK color values. Enabled by defaulthex
– Hex value. Enabled by defaultalpha
– Alpha value. Enabled by defaultpreview
– Preview of the color. Displays color with alpha in lower left corner and color without alpha in upper right corner. Enabled by defaultpreview-xl
– Larger preview of the colorpreview-square
– Square preview of the colorpreview-square-xl
– Larger square preview of the color
You can customize which of these fields are displayed and the order they are displayed in using the settings described below.
By default, the extension works with any css, sass, scss, or less document and recognizes all basic css color formats, including named colors. You can also enable Color Info in additional file types using the colorInfo.languages
setting
Ordered array of color fields to display.
Array of fields not to display. Overrides colorInfo.fields
. If you only need to exclude one or two of the default fields, using colorInfo.excludedFields
is the preferred approach.
Defines which files and languages have color info enabled, and which color types are supported. The default language setting enables all css color values for css
, sass
, and less
documents:
"colorInfo.languages": [
{
"selector": "css",
"colors": "css"
}, {
"selector": "sass",
"colors": "css"
}, {
"selector": "scss",
"colors": "css"
}, {
"selector": "less",
"colors": "css"
}
]
Each element consists of:
-
"selector"
- VSCode document selector. -
"colors"
- String or array of strings defining the types of colors to display information for. Valid values color types are:css
- All css color value typeshex
- Css hex (#ff00ff
or#f0f
)hex+alpha
- Css hex plus alpha (#ff00ff77
or#f0f7
)rgb
- Css rgb or rgba (rgb(1, 2, 3)
orrgba(1, 2, 3, 0.5)
) chsl
- Css hsl or hsla (hsl(1, 2, 3)
orhsla(1, 2, 3, 0.5)
)css-colors-names
- Css color names (red
,blue
)
VSCode does not currently support nested languages, so to enable Color Info in an html
file, you must add:
{
"selector": "html",
"colors": "css"
}
To your colorInfo.languages
setting. Make you add this setting to the end of the default colorInfo.languages
setting so that you do not disable Color Info for the standard languages.