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-15 21:06:30 +08:00
const borderColors = [
{
name: 'Bordure de base',
type: 'base',
color: '#DCDFE6',
},
{
name: 'Bordure claire',
type: 'light',
color: '#E4E7ED',
},
{
name: 'Bordure très claire',
type: 'lighter',
color: '#EBEEF5',
},
{
name: 'Bordure extra claire',
type: 'extra-light',
color: '#F2F6FC',
},
]
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',
'textPrimary': '$--color-text-primary',
'textRegular': '$--color-text-regular',
'textSecondary': '$--color-text-secondary',
'textPlaceholder': '$--color-text-placeholder',
};
const original = {
primary: '#409EFF',
success: '#67C23A',
warning: '#E6A23C',
danger: '#F56C6C',
info: '#909399',
white: '#FFFFFF',
black: '#000000',
textPrimary: '#303133',
textRegular: '#606266',
textSecondary: '#909399',
textPlaceholder: '#C0C4CC',
}
export default {
2021-07-15 21:06:30 +08:00
components: {
2021-07-20 22:58:06 +08:00
BorderBox,
ColorBox,
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: '',
textPrimary: '',
textRegular: '',
textSecondary: '',
textPlaceholder: '',
2021-07-15 21:06:30 +08:00
borderColors,
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 >
## Couleur
2021-07-15 21:06:30 +08:00
2020-10-16 11:14:34 +08:00
Element Plus utilise un ensemble de palettes spécifiques afin de fournir un style consistant pour vos produits.
2020-08-13 15:18:26 +08:00
### Couleur principale
2020-10-16 11:14:34 +08:00
La couleur principale d'Element Plus est un bleu clair et agréable.
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 }" > Couleur principale
< 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 >
### Couleurs secondaires
En plus de la couleur principale, vous devrez sans doute utiliser d'autres couleurs pour différents cas de figures, par exemple une couleur de danger pour indiquer une opération dangereuse.
2021-07-20 22:58:06 +08:00
< color-box / >
2020-08-13 15:18:26 +08:00
### Couleurs neutres
Les couleurs neutres sont les couleurs du fond, du texte et des bordures. Vous pouvez utiliser différentes couleurs neutres pour représenter une structure hiérarchique.
< el-row :gutter = "12" >
< el-col :span = "6" :xs = "{span: 12}" >
< div class = "demo-color-box-group" >
< div class = "demo-color-box demo-color-box-other"
:style="{ background: textPrimary }"
>Texte principal< div class = "value" > {{textPrimary}}< / div > < / div >
< div class = "demo-color-box demo-color-box-other"
:style="{ background: textRegular }"
>
Texte normal< div class = "value" > {{textRegular}}< / div > < / div >
< div class = "demo-color-box demo-color-box-other"
:style="{ background: textSecondary }"
>Texte secondaire< div class = "value" > {{textSecondary}}< / div > < / div >
< div class = "demo-color-box demo-color-box-other"
:style="{ background: textPlaceholder }"
>Texte de placeholder< div class = "value" > {{textPlaceholder}}< / div > < / div >
< / div >
< / 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 }"
>Noir< div class = "value" > {{black}}< / div > < / div >
< div
class="demo-color-box demo-color-box-other"
:style="{ background: white, color: '#303133', border: '1px solid #eee ' }"
>Blanc< div class = "value" > {{white}}< / div > < / div >
< div class = "demo-color-box demo-color-box-other bg-transparent" > Transparent< div class = "value" > Transparent< / div >
< / div >
< / div >
< / el-col >
< / el-row >