生成 Material 风格颜色样式_html/css_WEB-ITnose
程序员文章站
2022-05-29 20:25:56
...
theme-color
Material theme color generator.
DEMO
http://qingwei-li.github.io/theme-color/
Install
$ npm i theme-color -S
Quick Start
import ThemeColor from 'theme-color'const tc = new ThemeColor('blue', 'red')tc.get()/*{ "lightPrimary": "#BBDEFB", "primary": "#2196F3", "darkPrimary": "#1976D2", "accent": "#FF5252"}*/tc.css({ prefix: 'color-'})/* .color-light-primary: { background-color: "#BBDEFB"; } .color-primary: { background-color: "#2196F3"; } .color-dark-primary: { background-color: "#1976D2"; } .color-accent { background-color: "#FF5252"; } */
Options
- primaryColor: String
- accentColor: String
Material color: ['red', 'pink', 'purple', 'deepPurple', 'indigo', 'blue', 'lightBlue', 'cyan', 'teal', 'green', 'lightGreen', 'lime', 'yellow', 'amber', 'orange', 'deepOrange', 'brown', 'grey', 'blueGrey']
// primary color blue, accent color redvar tc = new ThemeColor('blue', 'red')// randomvar tc = new ThemeColor()// random accent colorvar tc = new ThemeColor('blue')
API
get()
theme color object. like
{ "lightPrimary": "#BBDEFB", "primary": "#2196F3", "darkPrimary": "#1976D2", "accent": "#FF5252"}
css(options: Object)
return css string.
const tc = new ThemeColor('blue', 'red')tc.css({ prefix: 'tc-', suffix: '-color', primary: 'main', lightPrimary: 'light-main', darkPrimary: 'dark-main', accent: 'second'})
output
.tc-light-main-color: {background-color: #BBDEFB;}.tc-main-color: {background-color: #2196F3;}.tc-dark-main-color: {background-color: #1976D2;}.tc-second-color: {background-color: #FF5252;}
CLI
-c --config
config file. like
{ "color": ["blue", "red"], "css": { "prefix": "tc-", "suffix": "-color", "primary": "main", "darkPrimary": "dark-main", "lightPrimary": "light-main", "accent": "second" }}
-o --output
output css file.
-d --demo
output demo html file.
License
WTFPL
推荐阅读
-
CSS样式:把一个段中的几个短语颜色设置成不同于文本的颜色,用span标签。_html/css_WEB-ITnose
-
生成 Material 风格颜色样式_html/css_WEB-ITnose
-
Ueditor uParse功能Bug,生成了全局CSS: li,影响全局样式, 造成网页其它部分显示混乱解决方案_html/css_WEB-ITnose
-
CSS3可视化渐变背景颜色代码生成插件_html/css_WEB-ITnose
-
CSS3可视化渐变背景颜色代码生成插件_html/css_WEB-ITnose
-
生成 Material 风格颜色样式_html/css_WEB-ITnose
-
CSS 模拟实现 Material Design 样式的悬浮操作按钮_html/css_WEB-ITnose
-
DIV+CSS颜色边框背景等样式_html/css_WEB-ITnose
-
Ueditor uParse功能Bug,生成了全局CSS: li,影响全局样式, 造成网页其它部分显示混乱解决方案_html/css_WEB-ITnose
-
引入CSS外部样式生成页面后无效_html/css_WEB-ITnose