|
| 1 | +<script setup lang="ts"> |
| 2 | +import { VAR_HUE } from '@proj-airi/unocss-preset-chromatic' |
| 3 | +import { onMounted, ref, watch } from 'vue' |
| 4 | +
|
| 5 | +import ColorHueRange from './components/ColorHueRange.vue' |
| 6 | +
|
| 7 | +const DEFAULT_THEME_COLORS_HUE = 220.25 |
| 8 | +const themeColorsHue = ref(DEFAULT_THEME_COLORS_HUE) |
| 9 | +
|
| 10 | +onMounted(() => { |
| 11 | + const hue = document.documentElement.style.getPropertyValue(VAR_HUE) |
| 12 | + const hueF = Number.parseFloat(hue) |
| 13 | + themeColorsHue.value = hueF >= 0 && hueF <= 360 ? hueF : DEFAULT_THEME_COLORS_HUE |
| 14 | + document.documentElement.style.setProperty(VAR_HUE, themeColorsHue.value.toString()) |
| 15 | +}) |
| 16 | +
|
| 17 | +watch(themeColorsHue, () => { |
| 18 | + document.documentElement.style.setProperty(VAR_HUE, themeColorsHue.value.toString()) |
| 19 | +}) |
| 20 | +</script> |
| 21 | + |
1 | 22 | <template>
|
2 |
| - <div class="text-zero"> |
3 |
| - 0 |
4 |
| - </div> |
5 |
| - <div class="text-thirty"> |
6 |
| - 30 |
7 |
| - </div> |
8 |
| - <div class="text-sixty"> |
9 |
| - 60 |
10 |
| - </div> |
11 |
| - <div class="text-ninety"> |
12 |
| - 90 |
13 |
| - </div> |
14 |
| - <div class="text-hundred-twenty"> |
15 |
| - 120 |
16 |
| - </div> |
17 |
| - <div class="text-hundred-fifty"> |
18 |
| - 150 |
19 |
| - </div> |
20 |
| - <div class="text-hundred-eighty"> |
21 |
| - 180 |
22 |
| - </div> |
23 |
| - <div class="text-two-ten"> |
24 |
| - 210 |
25 |
| - </div> |
26 |
| - <div class="text-two-forty"> |
27 |
| - 240 |
28 |
| - </div> |
29 |
| - <div class="text-two-seventy"> |
30 |
| - 270 |
31 |
| - </div> |
32 |
| - <div class="text-three-hundred"> |
33 |
| - 300 |
34 |
| - </div> |
35 |
| - <div class="text-three-thirty"> |
36 |
| - 330 |
| 23 | + <div class="mx-auto max-w-screen-xl p-4 font-sans"> |
| 24 | + <div> |
| 25 | + <ColorHueRange |
| 26 | + v-model="themeColorsHue" |
| 27 | + class="w-full" |
| 28 | + :disabled="false" |
| 29 | + /> |
| 30 | + </div> |
| 31 | + <div> |
| 32 | + <div class="flex gap-2"> |
| 33 | + <div class="text-zero"> |
| 34 | + 0 |
| 35 | + </div> |
| 36 | + <div class="text-thirty"> |
| 37 | + 30 |
| 38 | + </div> |
| 39 | + <div class="text-sixty"> |
| 40 | + 60 |
| 41 | + </div> |
| 42 | + <div class="text-ninety"> |
| 43 | + 90 |
| 44 | + </div> |
| 45 | + <div class="text-hundred-twenty"> |
| 46 | + 120 |
| 47 | + </div> |
| 48 | + <div class="text-hundred-fifty"> |
| 49 | + 150 |
| 50 | + </div> |
| 51 | + <div class="text-hundred-eighty"> |
| 52 | + 180 |
| 53 | + </div> |
| 54 | + <div class="text-two-ten"> |
| 55 | + 210 |
| 56 | + </div> |
| 57 | + <div class="text-two-forty"> |
| 58 | + 240 |
| 59 | + </div> |
| 60 | + <div class="text-two-seventy"> |
| 61 | + 270 |
| 62 | + </div> |
| 63 | + <div class="text-three-hundred"> |
| 64 | + 300 |
| 65 | + </div> |
| 66 | + <div class="text-three-thirty"> |
| 67 | + 330 |
| 68 | + </div> |
| 69 | + </div> |
| 70 | + </div> |
37 | 71 | </div>
|
38 | 72 | </template>
|
0 commit comments