-
Notifications
You must be signed in to change notification settings - Fork 1k
/
ColorsDemo.vue
169 lines (154 loc) · 6.2 KB
/
ColorsDemo.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<template>
<div>
<div class="content-section documentation">
<h1>Colors</h1>
<p>Each PrimeVue theme exports its own color palette.</p>
<h5>Getting Started</h5>
<p>Colors are exported as CSS variables and used with the standard <i>var</i> syntax such as <i>var(--text-color)</i>.</p>
<pre v-code><code>
<span :style="{color:var(--text-color)}"></span>
</code></pre>
<h5>General Colors</h5>
<p>These are common variables used throughout the theme.</p>
<div class="doc-tablewrapper">
<table class="doc-table">
<thead>
<tr>
<th>Variable</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><i>--text-color</i></td>
<td>Font text color.</td>
</tr>
<tr>
<td><i>--text-color-secondary</i></td>
<td>Muted font text color with a secondary level.</td>
</tr>
<tr>
<td><i>--primary-color</i></td>
<td>Primary color of the theme.</td>
</tr>
<tr>
<td><i>--primary-color-text</i></td>
<td>Text color when background is primary color.</td>
</tr>
<tr>
<td><i>--font-family</i></td>
<td>Font family of the theme.</td>
</tr>
<tr>
<td><i>--inline-spacing</i></td>
<td>Spacing between to adjacent items.</td>
</tr>
<tr>
<td><i>--border-radius</i></td>
<td>Common border radius of elements.</td>
</tr>
<tr>
<td><i>--focus-ring</i></td>
<td>Box shadow of a focused element.</td>
</tr>
<tr>
<td><i>--mask-bg</i></td>
<td>Background of an overlay mask.</td>
</tr>
</tbody>
</table>
</div>
<h5>Color Palette</h5>
<p>A palette consists of 9 colors where each color provides tints/shades from 50 to 900.</p>
<pre v-code><code>
<div :style="{backgroundColor:var(--blue-500)}"></div>
</code></pre>
<div class="card">
<div class="flex flex-wrap">
<div v-for="color of colors" :key="color" class="color-stack mr-6 mb-6">
<template v-for="shade of shades" :key="shade">
<div v-if="shade !== 0" class="color-box"
:style="{backgroundColor:`var(--${color}-${shade})`, color: (shade > 500 ? '#fff': '#000')}">
{{color}}-{{shade}}
</div>
</template>
</div>
</div>
</div>
<h5>Surfaces</h5>
<p>In addition, a theme brings a special palette called surfaces that can be used as the base when designing the surface layers and separators.</p>
<div class="card">
<div class="color-stack">
<div v-for="shade in shades" :key="shade" class="color-box"
:style="{backgroundColor:`var(--surface-${shade})`, color: $appState.darkTheme ? '#fff': (shade > 500 ? '#fff': '#000')}">
surface-{{shade}}
</div>
</div>
</div>
<p>A theme also exports named surfaces for common use cases.</p>
<div class="doc-tablewrapper">
<table class="doc-table">
<thead>
<tr>
<th>Variable</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><i>--surface-ground</i></td>
<td>Base ground color.</td>
</tr>
<tr>
<td><i>--surface-section</i></td>
<td>Color of a section on a ground surface.</td>
</tr>
<tr>
<td><i>--surface-card</i></td>
<td>Color of a surface used as a card.</td>
</tr>
<tr>
<td><i>--surface-overlay</i></td>
<td>Color of overlay surfaces.</td>
</tr>
<tr>
<td><i>--surface-border</i></td>
<td>Color of a divider.</td>
</tr>
<tr>
<td><i>--surface-hover</i></td>
<td>Color of an element in hover state.</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
colors: ['blue', 'green', 'yellow', 'cyan', 'pink', 'indigo', 'teal', 'orange', 'bluegray', 'purple', 'red', 'gray', 'primary'],
shades: [0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900]
}
}
}
</script>
<style lang="scss" scoped>
.color-stack {
display: flex;
flex-direction: column;
}
.color-box {
width: 2.5rem;
display: flex;
align-items: center;
padding: 1rem;
width: 250px;
font-weight: bold;
}
.sample-layout {
width: 375px;
}
</style>