2020-08-13 15:18:26 +08:00
|
|
|
<script>
|
|
|
|
import bus from '../../bus';
|
|
|
|
import { tintColor } from '../../color.js';
|
2021-07-15 21:06:30 +08:00
|
|
|
import BorderBox from "../../components/demo/color/border-box.vue"
|
2021-07-20 22:58:06 +08:00
|
|
|
import ColorBox from "../../components/demo/color/color-box.vue"
|
2021-07-25 00:01:34 +08:00
|
|
|
import TextBox from "../../components/demo/color/text-box.vue"
|
2021-07-15 21:06:30 +08:00
|
|
|
const borderColors = [
|
|
|
|
{
|
|
|
|
name: '一级边框',
|
|
|
|
type: 'base',
|
|
|
|
color: '#DCDFE6',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '二级边框',
|
|
|
|
type: 'light',
|
|
|
|
color: '#E4E7ED',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '三级边框',
|
|
|
|
type: 'lighter',
|
|
|
|
color: '#EBEEF5',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '四级边框',
|
|
|
|
type: 'extra-light',
|
|
|
|
color: '#F2F6FC',
|
|
|
|
},
|
|
|
|
]
|
2021-07-25 00:01:34 +08:00
|
|
|
|
|
|
|
const textColors = [
|
|
|
|
{
|
|
|
|
name: '主要文字',
|
|
|
|
type: 'primary',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '常规文字',
|
|
|
|
type: 'regular',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '次要文字',
|
|
|
|
type: 'secondary',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '占位文字',
|
|
|
|
type: 'placeholder',
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2020-08-13 15:18:26 +08:00
|
|
|
const varMap = {
|
|
|
|
'primary': '$--color-primary',
|
|
|
|
'success': '$--color-success',
|
|
|
|
'warning': '$--color-warning',
|
|
|
|
'danger': '$--color-danger',
|
|
|
|
'info': '$--color-info',
|
|
|
|
'white': '$--color-white',
|
|
|
|
'black': '$--color-black',
|
|
|
|
};
|
|
|
|
const original = {
|
|
|
|
primary: '#409EFF',
|
|
|
|
success: '#67C23A',
|
|
|
|
warning: '#E6A23C',
|
|
|
|
danger: '#F56C6C',
|
|
|
|
info: '#909399',
|
|
|
|
white: '#FFFFFF',
|
|
|
|
black: '#000000',
|
|
|
|
}
|
|
|
|
export default {
|
2021-07-15 21:06:30 +08:00
|
|
|
components: {
|
2021-07-20 22:58:06 +08:00
|
|
|
BorderBox,
|
|
|
|
ColorBox,
|
2021-07-25 00:01:34 +08:00
|
|
|
TextBox,
|
2021-07-15 21:06:30 +08:00
|
|
|
},
|
2020-08-13 15:18:26 +08:00
|
|
|
mounted() {
|
|
|
|
this.setGlobal();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
tintColor(color, tint) {
|
|
|
|
return tintColor(color, tint);
|
|
|
|
},
|
|
|
|
setGlobal() {
|
|
|
|
if (window.userThemeConfig) {
|
|
|
|
this.global = window.userThemeConfig.global;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
global: {},
|
|
|
|
primary: '',
|
|
|
|
success: '',
|
|
|
|
warning: '',
|
|
|
|
danger: '',
|
|
|
|
info: '',
|
|
|
|
white: '',
|
|
|
|
black: '',
|
2021-07-25 00:01:34 +08:00
|
|
|
borderColors,
|
|
|
|
textColors,
|
2020-08-13 15:18:26 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
global: {
|
|
|
|
immediate: true,
|
|
|
|
handler(value) {
|
|
|
|
Object.keys(original).forEach((o) => {
|
|
|
|
if (value[varMap[o]]) {
|
|
|
|
this[o] = value[varMap[o]]
|
|
|
|
} else {
|
|
|
|
this[o] = original[o]
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
## Color 色彩
|
|
|
|
|
2020-10-16 11:14:34 +08:00
|
|
|
Element Plus 为了避免视觉传达差异,使用一套特定的调色板来规定颜色,为你所搭建的产品提供一致的外观视觉感受。
|
2020-08-13 15:18:26 +08:00
|
|
|
|
|
|
|
### 主色
|
|
|
|
|
2020-10-16 11:14:34 +08:00
|
|
|
Element Plus 主要品牌颜色是鲜艳、友好的蓝色。
|
2020-08-13 15:18:26 +08:00
|
|
|
|
|
|
|
<el-row :gutter="12">
|
|
|
|
<el-col :span="10" :xs="{span: 12}">
|
|
|
|
<div class="demo-color-box" :style="{ background: primary }">Brand Color
|
|
|
|
<div class="value">#409EFF</div>
|
|
|
|
<div class="bg-color-sub" :style="{ background: tintColor(primary, 0.9) }">
|
|
|
|
<div
|
|
|
|
class="bg-blue-sub-item"
|
|
|
|
v-for="(item, key) in Array(8)"
|
|
|
|
:key="key"
|
|
|
|
:style="{ background: tintColor(primary, (key + 1) / 10) }"
|
|
|
|
></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
### 辅助色
|
|
|
|
|
|
|
|
除了主色外的场景色,需要在不同的场景中使用(例如危险色表示危险的操作)。
|
|
|
|
|
2021-07-20 22:58:06 +08:00
|
|
|
<color-box />
|
2020-08-13 15:18:26 +08:00
|
|
|
|
|
|
|
### 中性色
|
|
|
|
|
|
|
|
中性色用于文本、背景和边框颜色。通过运用不同的中性色,来表现层次结构。
|
|
|
|
|
|
|
|
<el-row :gutter="12">
|
|
|
|
<el-col :span="6" :xs="{span: 12}">
|
2021-07-25 00:01:34 +08:00
|
|
|
<text-box :text-colors="textColors" />
|
2020-08-13 15:18:26 +08:00
|
|
|
</el-col>
|
|
|
|
<el-col :span="6" :xs="{span: 12}">
|
2021-07-15 21:06:30 +08:00
|
|
|
<border-box :border-colors="borderColors" />
|
2020-08-13 15:18:26 +08:00
|
|
|
</el-col>
|
|
|
|
<el-col :span="6" :xs="{span: 12}">
|
|
|
|
<div class="demo-color-box-group">
|
|
|
|
<div
|
|
|
|
class="demo-color-box demo-color-box-other"
|
|
|
|
:style="{ background: black }"
|
|
|
|
>基础黑色<div class="value">{{black}}</div></div>
|
|
|
|
<div
|
|
|
|
class="demo-color-box demo-color-box-other"
|
|
|
|
:style="{ background: white, color: '#303133', border: '1px solid #eee' }"
|
|
|
|
>基础白色<div class="value">{{white}}</div></div>
|
|
|
|
<div class="demo-color-box demo-color-box-other bg-transparent">透明<div class="value">Transparent</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|