mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 05:38:04 +00:00
feat: 增加设置页面和支持自定义强调色
This commit is contained in:
parent
7e892997bd
commit
bc696ca59f
14 changed files with 499 additions and 41 deletions
|
|
@ -1,6 +1,41 @@
|
|||
module.exports = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
const { colord } = require('colord')
|
||||
const colors = require('tailwindcss/colors')
|
||||
|
||||
const replaceBrandColorWithCssVar = () => {
|
||||
const blues = Object.entries(colors.blue).map(([key, value]) => {
|
||||
const c = colord(value).toRgb()
|
||||
return {
|
||||
key,
|
||||
rgb: `${c.r} ${c.g} ${c.b}`,
|
||||
}
|
||||
})
|
||||
return {
|
||||
postcssPlugin: 'replaceBrandColorWithCssVar',
|
||||
Declaration(decl) {
|
||||
let value = decl.value
|
||||
blues.forEach(blue => {
|
||||
value = value.replace(
|
||||
`rgb(${blue.rgb}`,
|
||||
`rgb(var(--brand-color-${blue.key})`
|
||||
)
|
||||
})
|
||||
// if (decl.value !== value) {
|
||||
// console.log({
|
||||
// before: decl.value,
|
||||
// after: value,
|
||||
// })
|
||||
// }
|
||||
decl.value = value
|
||||
},
|
||||
}
|
||||
}
|
||||
replaceBrandColorWithCssVar.postcss = true
|
||||
|
||||
module.exports = {
|
||||
plugins: [
|
||||
require('tailwindcss'),
|
||||
require('autoprefixer'),
|
||||
replaceBrandColorWithCssVar,
|
||||
],
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue