指尖上的记忆指尖上的记忆
首页
  • 基础
  • Laravel框架
  • Symfony框架
  • 基础
  • Gin框架
  • 基础
  • Spring框架
  • 命令
  • Nginx
  • Ai
  • Deploy
  • Docker
  • K8s
  • Micro
  • RabbitMQ
  • Mysql
  • PostgreSsql
  • Redis
  • MongoDb
  • Html
  • Js
  • 前端
  • 后端
  • Git
  • 知识扫盲
  • Golang
🌟 gitHub
首页
  • 基础
  • Laravel框架
  • Symfony框架
  • 基础
  • Gin框架
  • 基础
  • Spring框架
  • 命令
  • Nginx
  • Ai
  • Deploy
  • Docker
  • K8s
  • Micro
  • RabbitMQ
  • Mysql
  • PostgreSsql
  • Redis
  • MongoDb
  • Html
  • Js
  • 前端
  • 后端
  • Git
  • 知识扫盲
  • Golang
🌟 gitHub

tailwindcss之颜色定义以及Opacity的使用:

自定义颜色
:root{
	 --color-white: 255, 255, 255;
}


使用颜色变量:
const withOpacity = (variableName) =>
  `rgba(var(${variableName}), <alpha-value>)`;

white: withOpacity("--color-white"),

说明: the special <alpha-value> placeholder that Tailwind will use to inject the alpha value when using an opacity modifier,实际上就是看这个 white 用在哪里,如果是bg的话,那么 alpha-value 的值就是 bg-opacity-100 (默认是100,也就是1), 如果是text的话,就是 text-opacity-100,这些在 v2 版本下看的比较清楚. v3 下,默认没有展示这些属性,但是就是这么用的.

参考: https://tailwindcss.com/docs/customizing-colors#using-css-variables