Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>color-converterNew to Visual Studio Code? Get it now.
color-converter

color-converter

jsjzh

|
3,046 installs
| (2) | Free
转换 color 工具,支持 hex => rgb => hsl => hex
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

color-converter

介绍

该扩展可以帮助你直接转换色值,支持 hex => rgb => hsl => hex 转换,支持多个颜色选择转换。

使用方式

选择一个或者按住 Alt 选择多个颜色,例如

  • hex
    • #f44034b8
    • ##ff0fdb
    • #f1d
  • rgb
    • rgba(244, 64, 52, 0.72)
    • rgb(244, 64, 52)
    • rgb(255, 15, 219)
  • hsl
    • hsla(4, 90%, 58%, 0.72)
    • hsl(4, 90%, 58%)
    • hsl(309, 100%, 53%)

方式一(推荐)

直接使用 Ctrl + Alt + R(mac 上为 cmd + Alt + R) 即可切换颜色。

方式二

Alt + Shift + P 呼出控制台,输入 cc 即可转换颜色。

依赖

该扩展无需其他依赖。

扩展配置

该扩展暂无配置。

已知问题

  1. 选择了色值却无法转换,请注意可能是选择中前后有空格,因为正则中对于一个有效的色值判断为 /^[#rh].+\)$/(并不准确,请不要学我),所以如果前后有空格则不生效。

后续更新

  1. 对于色值的正则判断需要改改。
  2. 是否需要增加一个扩展配置,配置转换后的 rgb 或者 hsl 中是否有空格。
  3. rgba(0,0,0,.7) 无法正常处理,并且 rgba(0,0,0,0.7) 之后透明度消失。

版本

0.1.0

初版提交,初步功能完成。

0.1.2

将转换后过长的位数给处理掉了,如果有小数的话会保留一位小数。

0.1.4

修复 rgba(0,0,0,.7) 无法正常处理的问题,修复 rgba(0,0,0,0.7) 透明度消失的问题。

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft