-
Notifications
You must be signed in to change notification settings - Fork 691
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* config: support to use dark theme.
- Loading branch information
Showing
7 changed files
with
159 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,115 @@ | ||
const colors = require('./colors.cjs'); | ||
const shades = require('tailwindcss/colors'); | ||
const {reverseShade} = require('./reverse-shade.cjs'); | ||
|
||
// 语义化调色板 - Semantic palettes | ||
// ================================== | ||
|
||
/** 主要:主题的、可链接、正常 */ | ||
const primary = reverseShade(shades.blue); | ||
|
||
/** 次要:次级、常态的 */ | ||
const secondary = reverseShade(shades.sky); | ||
|
||
/** 成功:完成、积极 */ | ||
const success = reverseShade(shades.green); | ||
|
||
/** 关注:提示、重点 */ | ||
const warning = reverseShade(shades.amber); | ||
|
||
/** 警告:提示、异常、警醒 */ | ||
const danger = reverseShade(shades.red); | ||
|
||
/** 重要:优先 */ | ||
const important = reverseShade(shades.pink); | ||
|
||
/** 特殊:触动、激情 */ | ||
const special = reverseShade(shades.purple); | ||
|
||
/** 灰色:中立、背景、边框 */ | ||
const gray = reverseShade(shades.slate); | ||
|
||
|
||
// 特殊颜色 - Special Colors | ||
// ====================== | ||
|
||
/** 纯黑 */ | ||
const black = shades.black; | ||
|
||
/** 纯白 */ | ||
const white = shades.white; | ||
|
||
|
||
// UI 特殊颜色定义 - UI Special Colors | ||
// ====================== | ||
|
||
/** 画布(页面背景) */ | ||
const canvas = colors.gray[900]; | ||
const canvas = black; | ||
|
||
/** 画布反色 */ | ||
const inverse = colors.white; | ||
const inverse = white; | ||
|
||
/** 控件背景 */ | ||
const surfaceLight = gray[50]; | ||
|
||
/** 控件背景 */ | ||
const surface = gray[100]; | ||
|
||
/** 控件背景 */ | ||
const surface = colors.gray[800]; | ||
const surfaceStrong = gray[200]; | ||
|
||
/** 文本 */ | ||
const fore = colors.gray[200]; | ||
const fore = gray[700]; | ||
|
||
/** 焦点 */ | ||
const focus = colors.primary[600]; | ||
const focus = primary[200]; | ||
|
||
/** 链接 */ | ||
const link = colors.primary[500]; | ||
const link = primary[500]; | ||
|
||
/** 链接(hover) */ | ||
const linkHover = colors.primary[300]; | ||
const linkHover = primary[600]; | ||
|
||
/** 链接(visited) */ | ||
const linkVisited = primary[700]; | ||
|
||
/** 链接(Active) */ | ||
const linkActive = primary[800]; | ||
|
||
/* 占位文本颜色(placeholder) */ | ||
const placeholder = gray[400]; | ||
|
||
/** Border */ | ||
const border = colors.gray[700]; | ||
const border = gray[200]; | ||
|
||
/** Strong border */ | ||
const borderStrong = gray[300]; | ||
|
||
/** Strong border */ | ||
const borderLight = gray[100]; | ||
|
||
module.exports = { | ||
gray, | ||
primary, | ||
secondary, | ||
success, | ||
warning, | ||
danger, | ||
important, | ||
special, | ||
|
||
canvas, | ||
inverse, | ||
surface, | ||
'surface-light': surfaceLight, | ||
'surface-strong': surfaceStrong, | ||
fore, | ||
focus, | ||
link, | ||
'link-hover': linkHover, | ||
'link-visited': linkVisited, | ||
'link-active': linkActive, | ||
placeholder, | ||
border, | ||
'border-strong': borderStrong, | ||
'border-light': borderLight, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,6 @@ module.exports = { | |
boxShadow: toVars(boxShadow, 'shadow'), | ||
zIndex, | ||
screens, | ||
variables, | ||
...variables, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* Reverse tailwind shade list. | ||
* | ||
* @param {{'50': string, '100': string, '200': string, '300': string, '400': string, '500': string, '600': string, '700': string, '800': string, '900': string, '950': string}} shade | ||
* @returns {{'50': string, '100': string, '200': string, '300': string, '400': string, '500': string, '600': string, '700': string, '800': string, '900': string, '950': string}} | ||
*/ | ||
function reverseShade(shade) { | ||
const keys = Object.keys(shade).sort((a, b) => Number(a) - Number(b)); | ||
return keys.reduce((reversedShade, key, index) => { | ||
reversedShade[key] = shade[keys[keys.length - 1 - index]]; | ||
return reversedShade; | ||
}, {}); | ||
} | ||
|
||
module.exports = { | ||
reverseShade, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters