【问题标题】:tailwind: customize a xxx base color without loosing clases like xxx-100, xxx-200顺风:自定义 xxx 基色,而不会丢失 xxx-100、xxx-200 等类
【发布时间】:2021-09-03 22:33:49
【问题描述】:

我想在 tailwind.css 中定义 text-blue 颜色,而不会丢失 text-blue-100、text-blue-200 等。

我遵循本指南:https://tailwindcss.com/docs/customizing-colors#extending-the-defaults

我尝试:

// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      colors: {
        blue: '#5F99F7'
      }
    }
  }
}

但是所有 text-blue-xxx 都消失了

有什么办法解决吗?

【问题讨论】:

    标签: colors customization tailwind-css color-scheme


    【解决方案1】:

    如果您希望类为text-blue,则需要使用DEFAULT 关键字。您还需要将蓝色设为对象。

    // tailwind.config.js
    module.exports = {
      theme: {
        extend: {
          colors: {
            blue: {
              'DEFAULT': '#5F99F7'
            },
          }
        }
      }
    }
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-09-14
    • 2012-11-20
    • 2023-03-10
    • 1970-01-01
    • 2016-06-04
    • 2021-03-23
    相关资源
    最近更新 更多