2020-11-04 10:30:14 +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 = [
|
|
|
|
{
|
|
|
|
type: 'base',
|
|
|
|
color: '#DCDFE6',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'light',
|
|
|
|
color: '#E4E7ED',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'lighter',
|
|
|
|
color: '#EBEEF5',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'extra-light',
|
|
|
|
color: '#F2F6FC',
|
|
|
|
},
|
|
|
|
]
|
2021-07-25 00:01:34 +08:00
|
|
|
|
|
|
|
const textColors = [
|
|
|
|
{
|
|
|
|
name: 'Primary Text',
|
|
|
|
type: 'primary',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Regular Text',
|
|
|
|
type: 'regular',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Secondary Text',
|
|
|
|
type: 'secondary',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Placeholder Text',
|
|
|
|
type: 'placeholder',
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2020-11-04 10:30:14 +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-11-04 10:30:14 +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-15 21:06:30 +08:00
|
|
|
borderColors,
|
2021-07-25 00:01:34 +08:00
|
|
|
textColors,
|
2020-11-04 10:30:14 +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>
|
|
|
|
|
|
|
|
## カラー
|
2021-07-15 21:06:30 +08:00
|
|
|
|
|
|
|
Element Plus は、特定のパレットセットを用いて色を指定し、プロダクトに一貫した外観と使用感を提供します。
|
2020-11-04 10:30:14 +08:00
|
|
|
|
|
|
|
### メインカラー
|
2021-07-15 21:06:30 +08:00
|
|
|
|
|
|
|
Element Plus のメインカラーは明るく親しみやすいブルーです。
|
2020-11-04 10:30:14 +08:00
|
|
|
|
|
|
|
<el-row :gutter="12">
|
|
|
|
<el-col :span="10" :xs="{span: 12}">
|
2021-07-15 21:06:30 +08:00
|
|
|
<div
|
2020-11-04 10:30:14 +08:00
|
|
|
class="demo-color-box"
|
|
|
|
:style="{ background: primary }"
|
|
|
|
>
|
|
|
|
Brand Color<div class="value">#409EFF</div>
|
2021-07-15 21:06:30 +08:00
|
|
|
<div
|
2020-11-04 10:30:14 +08:00
|
|
|
class="bg-color-sub"
|
|
|
|
:style="{ background: tintColor(primary, 0.9) }"
|
|
|
|
>
|
2021-07-15 21:06:30 +08:00
|
|
|
<div
|
|
|
|
class="bg-blue-sub-item"
|
2020-11-04 10:30:14 +08:00
|
|
|
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-11-04 10:30:14 +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-11-04 10:30:14 +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-11-04 10:30:14 +08:00
|
|
|
</el-col>
|
|
|
|
<el-col :span="6" :xs="{span: 12}">
|
|
|
|
<div class="demo-color-box-group">
|
2021-07-15 21:06:30 +08:00
|
|
|
<div
|
2020-11-04 10:30:14 +08:00
|
|
|
class="demo-color-box demo-color-box-other"
|
|
|
|
:style="{ background: black }"
|
|
|
|
>Basic 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' }"
|
|
|
|
>Basic White<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>
|