繁体   English   中英

vscode顺风CSS如何在智能感知中拥有所有colors? (如`bg-sky`)

[英]vscode tailwind CSS how to have all colors in intellisense? (like `bg-sky`)

这是我所看到的:

  • 白色的
  • 灰色的
  • 红色的
  • 黄色
  • 绿色
  • 蓝色的
  • 紫色的
  • 粉色的

在此处输入图像描述

但我也想拥有:

所有这些https://tailwindcss.com/docs/background-color

  • 石板
  • 中性的
  • 结石
  • 琥珀色
  • 酸橙
  • 青色
  • 青色
  • 天空
  • 紫色
  • 紫红色
  • 玫瑰

在此处输入图像描述


在编辑器中它没有显示它: 在此处输入图像描述

但例如红色是的: 在此处输入图像描述

您可以通过将这些顺风 colors 导入并将它们添加到tailwind.config中的默认调色板来获得智能感知,如下所示:

const colors = require('tailwindcss/colors')

module.exports = {
  theme: {
    colors: {
      transparent: 'transparent',
      current: 'currentColor',
      black: colors.black,
      white: colors.white,
      gray: colors.slate,
      green: colors.emerald,
      purple: colors.violet,
      yellow: colors.amber,
      pink: colors.fuchsia,
    },
  },
}

有关参考,请参阅https://tailwindcss.com/docs/customizing-colors#aliasing-color-names

如果需要,您还可以扩展这些 colors,这样您就不必将每种颜色都添加到默认值中。

module.exports = {
  theme: {
    extend: {
      colors: {
        sky: colors.sky
      }
    },
  },
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM