Commit 99cf79b400
Unsigned
Layout: unified · split
docs/.vitepress/theme/Layout.vue +61 −2
| @@ -34,11 +34,11 @@ import { | ||
| 34 | 34 | NolebaseEnhancedReadabilitiesScreenMenu |
| 35 | 35 | } from './components/settings' |
| 36 | 36 | import SidebarCard from './components/SidebarCard.vue' |
| 37 | import { LowEndDeviceModeStorageKey, TakodachiStorageKey } from './constants' | |
| 37 | import { AccentColorStorageKey, LowEndDeviceModeStorageKey, TakodachiStorageKey } from './constants' | |
| 38 | 38 | import { v2add, v2mag, v2norm, v2smul, v2sub, type Vec2D } from './math' |
| 39 | 39 | |
| 40 | 40 | const route = useRoute() |
| 41 | const { frontmatter, site, theme } = useData() | |
| 41 | const { frontmatter, isDark, site, theme } = useData() | |
| 42 | 42 | const { Layout } = DefaultTheme |
| 43 | 43 | |
| 44 | 44 | // Home sidebar menu |
| @@ -572,6 +572,65 @@ watchEffect(() => { | ||
| 572 | 572 | ) |
| 573 | 573 | }) |
| 574 | 574 | |
| 575 | const accentPalettes: Record<string, Record<string, string>> = { | |
| 576 | ayanami: { | |
| 577 | 400: 'oklch(0.722 0.105 247.48)', | |
| 578 | 500: 'oklch(0.626 0.098 247.46)', | |
| 579 | 600: 'oklch(0.523 0.081 246.86)', | |
| 580 | 700: 'oklch(0.43 0.066 246.75)', | |
| 581 | 800: 'oklch(0.335 0.052 246.76)', | |
| 582 | }, | |
| 583 | asuka: { | |
| 584 | 400: '#FB7F6E', | |
| 585 | 500: '#F35640', | |
| 586 | 600: '#E2432D', | |
| 587 | 700: '#BD2C18', | |
| 588 | 800: '#9C2818', | |
| 589 | }, | |
| 590 | rebecca: { | |
| 591 | 400: '#41E799', | |
| 592 | 500: '#18CF7A', | |
| 593 | 600: '#0DAC62', | |
| 594 | 700: '#0E874F', | |
| 595 | 800: '#116A42', | |
| 596 | }, | |
| 597 | okayu: { | |
| 598 | 400: '#CDA4D5', | |
| 599 | 500: '#BC87C5', | |
| 600 | 600: '#A86BB2', | |
| 601 | 700: '#915799', | |
| 602 | 800: '#794A7F', | |
| 603 | }, | |
| 604 | inanis: { | |
| 605 | 400: '#A39AC0', | |
| 606 | 500: '#8F81B0', | |
| 607 | 600: '#816FA1', | |
| 608 | 700: '#766392', | |
| 609 | 800: '#645479', | |
| 610 | }, | |
| 611 | } | |
| 612 | ||
| 613 | const accentColor = useStorage(AccentColorStorageKey, 'ayanami') | |
| 614 | ||
| 615 | watchEffect(() => { | |
| 616 | if (import.meta.env.SSR) return | |
| 617 | const shades = accentPalettes[accentColor.value] ?? accentPalettes.ayanami | |
| 618 | const el = document.documentElement | |
| 619 | if (isDark.value) { | |
| 620 | el.style.setProperty('--vp-c-brand-1', shades['400']) | |
| 621 | el.style.setProperty('--vp-c-brand-2', shades['500']) | |
| 622 | el.style.setProperty('--vp-c-brand-3', shades['700']) | |
| 623 | el.style.setProperty('--vp-c-brand-soft', `color-mix(in srgb, ${shades['500']} 20%, transparent)`) | |
| 624 | el.style.setProperty('--vp-c-sidebar-active', `color-mix(in srgb, ${shades['500']} 15%, transparent)`) | |
| 625 | } else { | |
| 626 | el.style.setProperty('--vp-c-brand-1', shades['500']) | |
| 627 | el.style.setProperty('--vp-c-brand-2', shades['600']) | |
| 628 | el.style.setProperty('--vp-c-brand-3', shades['800']) | |
| 629 | el.style.setProperty('--vp-c-brand-soft', `color-mix(in srgb, ${shades['400']} 40%, transparent)`) | |
| 630 | el.style.setProperty('--vp-c-sidebar-active', `color-mix(in srgb, ${shades['800']} 15%, transparent)`) | |
| 631 | } | |
| 632 | }) | |
| 633 | ||
| 575 | 634 | const speed = 2 |
| 576 | 635 | const snapThreshold = 5 // px |
| 577 | 636 | |
docs/.vitepress/theme/components/Search.vue +8 −8
| @@ -2475,9 +2475,9 @@ function onMouseMove(e: MouseEvent) { | ||
| 2475 | 2475 | } |
| 2476 | 2476 | |
| 2477 | 2477 | .page-pill.active { |
| 2478 | color: #6ab0f5; | |
| 2479 | border: 1.5px solid #6ab0f5; | |
| 2480 | background: rgba(60, 120, 210, 0.12); | |
| 2478 | color: var(--vp-c-brand-1); | |
| 2479 | border: 1.5px solid var(--vp-c-brand-1); | |
| 2480 | background: color-mix(in srgb, var(--vp-c-brand-1) 12%, transparent); | |
| 2481 | 2481 | box-shadow: none; |
| 2482 | 2482 | } |
| 2483 | 2483 | |
| @@ -2497,7 +2497,7 @@ function onMouseMove(e: MouseEvent) { | ||
| 2497 | 2497 | } |
| 2498 | 2498 | |
| 2499 | 2499 | .page-pill.active .page-pill-count { |
| 2500 | background: rgba(100, 160, 240, 0.18); | |
| 2500 | background: color-mix(in srgb, var(--vp-c-brand-1) 18%, transparent); | |
| 2501 | 2501 | } |
| 2502 | 2502 | |
| 2503 | 2503 | @media (max-width: 767px) { |
| @@ -2872,7 +2872,7 @@ svg { | ||
| 2872 | 2872 | |
| 2873 | 2873 | .exact-match-button.exact-match-active { |
| 2874 | 2874 | color: var(--vp-c-brand-1); |
| 2875 | background-color: rgba(var(--vp-c-brand-1), 0.1); | |
| 2875 | background-color: color-mix(in srgb, var(--vp-c-brand-1) 10%, transparent); | |
| 2876 | 2876 | border-radius: 4px; |
| 2877 | 2877 | } |
| 2878 | 2878 | |
| @@ -2921,7 +2921,7 @@ svg { | ||
| 2921 | 2921 | |
| 2922 | 2922 | .mode-btn.mode-active { |
| 2923 | 2923 | color: var(--vp-c-brand-1); |
| 2924 | background: rgba(60, 120, 210, 0.10); | |
| 2924 | background: color-mix(in srgb, var(--vp-c-brand-1) 10%, transparent); | |
| 2925 | 2925 | } |
| 2926 | 2926 | |
| 2927 | 2927 | :deep(.url-highlight) { |
| @@ -2984,7 +2984,7 @@ svg { | ||
| 2984 | 2984 | |
| 2985 | 2985 | .url-page-btn.active { |
| 2986 | 2986 | color: var(--vp-c-brand-1); |
| 2987 | background: rgba(60, 120, 210, 0.10); | |
| 2987 | background: color-mix(in srgb, var(--vp-c-brand-1) 10%, transparent); | |
| 2988 | 2988 | font-weight: 500; |
| 2989 | 2989 | cursor: default; |
| 2990 | 2990 | } |
| @@ -3090,7 +3090,7 @@ svg { | ||
| 3090 | 3090 | |
| 3091 | 3091 | .settings-option.active { |
| 3092 | 3092 | color: var(--vp-c-brand-1); |
| 3093 | background: rgba(60, 120, 210, 0.1); | |
| 3093 | background: color-mix(in srgb, var(--vp-c-brand-1) 10%, transparent); | |
| 3094 | 3094 | } |
| 3095 | 3095 | |
| 3096 | 3096 | .settings-popup-enter-active, |
docs/.vitepress/theme/components/settings/AccentColor.vue added +79
| @@ -0,0 +1,79 @@ | ||
| 1 | <script setup lang="ts"> | |
| 2 | import { useStorage } from '@vueuse/core' | |
| 3 | ||
| 4 | import { AccentColorStorageKey } from '../../constants' | |
| 5 | import MenuTitle from './MenuTitle.vue' | |
| 6 | ||
| 7 | const accentOptions = [ | |
| 8 | { key: 'ayanami', label: 'Ayanami', color: 'oklch(0.626 0.098 247.46)' }, | |
| 9 | { key: 'asuka', label: 'Asuka', color: '#F35640' }, | |
| 10 | { key: 'rebecca', label: 'Rebecca', color: '#18CF7A' }, | |
| 11 | { key: 'okayu', label: 'Okayu', color: '#BC87C5' }, | |
| 12 | { key: 'inanis', label: "Ina'nis", color: '#8F81B0' }, | |
| 13 | ] as const | |
| 14 | ||
| 15 | const accentColor = useStorage(AccentColorStorageKey, 'ayanami') | |
| 16 | </script> | |
| 17 | ||
| 18 | <template> | |
| 19 | <div> | |
| 20 | <MenuTitle title="Accent Color" aria-label="Accent Color" mb-2> | |
| 21 | <template #icon> | |
| 22 | <span i-lucide:palette mr-1 aria-hidden="true" /> | |
| 23 | </template> | |
| 24 | </MenuTitle> | |
| 25 | <div class="accent-grid"> | |
| 26 | <button | |
| 27 | v-for="option in accentOptions" | |
| 28 | :key="option.key" | |
| 29 | class="accent-btn" | |
| 30 | :aria-pressed="accentColor === option.key" | |
| 31 | :aria-label="option.label" | |
| 32 | @click="accentColor = option.key" | |
| 33 | > | |
| 34 | <span class="accent-swatch" :style="{ backgroundColor: option.color }" /> | |
| 35 | <span class="accent-label">{{ option.label }}</span> | |
| 36 | <span v-if="accentColor === option.key" i-lucide:check text-xs ml-auto /> | |
| 37 | </button> | |
| 38 | </div> | |
| 39 | </div> | |
| 40 | </template> | |
| 41 | ||
| 42 | <style scoped> | |
| 43 | .accent-grid { | |
| 44 | display: grid; | |
| 45 | grid-template-columns: 1fr 1fr; | |
| 46 | gap: 2px; | |
| 47 | } | |
| 48 | ||
| 49 | .accent-btn { | |
| 50 | display: flex; | |
| 51 | align-items: center; | |
| 52 | gap: 6px; | |
| 53 | padding: 5px 8px; | |
| 54 | border-radius: 8px; | |
| 55 | border: none; | |
| 56 | background: transparent; | |
| 57 | cursor: pointer; | |
| 58 | color: var(--vp-c-text-1); | |
| 59 | font-size: 13px; | |
| 60 | width: 100%; | |
| 61 | transition: background-color 0.15s; | |
| 62 | } | |
| 63 | ||
| 64 | .accent-btn:hover { | |
| 65 | background-color: var(--vp-c-bg-soft); | |
| 66 | } | |
| 67 | ||
| 68 | .accent-swatch { | |
| 69 | width: 16px; | |
| 70 | height: 16px; | |
| 71 | border-radius: 50%; | |
| 72 | flex-shrink: 0; | |
| 73 | } | |
| 74 | ||
| 75 | .accent-label { | |
| 76 | flex: 1; | |
| 77 | text-align: left; | |
| 78 | } | |
| 79 | </style> | |
docs/.vitepress/theme/components/settings/Menu.vue +2
| @@ -3,6 +3,7 @@ import { useMounted } from '@vueuse/core' | ||
| 3 | 3 | import { inject } from 'vue' |
| 4 | 4 | |
| 5 | 5 | import { InjectionKey, VPFlyout } from '../../constants' |
| 6 | import AccentColor from './AccentColor.vue' | |
| 6 | 7 | import BlurEffects from './BlurEffects.vue' |
| 7 | 8 | import LayoutSwitch from './LayoutSwitch.vue' |
| 8 | 9 | import LayoutSwitchContentLayoutWidthInput from './LayoutSwitchContentLayoutMaxWidthSlider.vue' |
| @@ -34,6 +35,7 @@ const mounted = useMounted() | ||
| 34 | 35 | <SpotlightStyles v-if="!options.spotlight?.disabled" /> |
| 35 | 36 | <BlurEffects /> |
| 36 | 37 | <Takodachi /> |
| 38 | <AccentColor /> | |
| 37 | 39 | </div> |
| 38 | 40 | </VPFlyout> |
| 39 | 41 | </template> |
docs/.vitepress/theme/components/settings/ScreenMenu.vue +2
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | <script setup lang="ts"> |
| 2 | 2 | import { useMounted } from '@vueuse/core' |
| 3 | 3 | |
| 4 | import AccentColor from './AccentColor.vue' | |
| 4 | 5 | import BlurEffects from './BlurEffects.vue' |
| 5 | 6 | import MenuTitle from './MenuTitle.vue' |
| 6 | 7 | import ScreenLayoutSwitch from './ScreenLayoutSwitch.vue' |
| @@ -20,6 +21,7 @@ const mounted = useMounted() | ||
| 20 | 21 | <ScreenLayoutSwitch /> |
| 21 | 22 | <ScreenSpotlight /> |
| 22 | 23 | <BlurEffects /> |
| 24 | <AccentColor /> | |
| 23 | 25 | </div> |
| 24 | 26 | </div> |
| 25 | 27 | </template> |
docs/.vitepress/theme/constants.ts +1
| @@ -28,6 +28,7 @@ export const SpotlightStylesStorageKey = | ||
| 28 | 28 | |
| 29 | 29 | export const LowEndDeviceModeStorageKey = 'preference-low-end-device-mode' |
| 30 | 30 | export const TakodachiStorageKey = 'preference-takodachi' |
| 31 | export const AccentColorStorageKey = 'preference-accent-color' | |
| 31 | 32 | |
| 32 | 33 | export enum LayoutMode { |
| 33 | 34 | FullWidth = 1, |
docs/.vitepress/theme/styles/style.scss +16 −15
| @@ -67,10 +67,10 @@ $ease-in-expo: cubic-bezier(0.7, 0, 0.84, 0); | ||
| 67 | 67 | |
| 68 | 68 | /* Colors: Custom Block */ |
| 69 | 69 | /** Info */ |
| 70 | --vp-custom-block-info-bg: theme("colors.brand.200"); | |
| 71 | --vp-custom-block-info-border: theme("colors.brand.800"); | |
| 72 | --vp-custom-block-info-text: theme("colors.brand.800"); | |
| 73 | --vp-custom-block-info-text-deep: theme("colors.brand.900"); | |
| 70 | --vp-custom-block-info-bg: color-mix(in srgb, var(--vp-c-brand-1) 15%, transparent); | |
| 71 | --vp-custom-block-info-border: var(--vp-c-brand-3); | |
| 72 | --vp-custom-block-info-text: var(--vp-c-brand-3); | |
| 73 | --vp-custom-block-info-text-deep: var(--vp-c-brand-3); | |
| 74 | 74 | /** Tip */ |
| 75 | 75 | --vp-custom-block-tip-bg: theme("colors.meadow.200"); |
| 76 | 76 | --vp-custom-block-tip-border: theme("colors.meadow.800"); |
| @@ -116,10 +116,10 @@ $ease-in-expo: cubic-bezier(0.7, 0, 0.84, 0); | ||
| 116 | 116 | |
| 117 | 117 | /* Colors: Custom Block */ |
| 118 | 118 | /** Info */ |
| 119 | --vp-custom-block-info-bg: theme("colors.brand.950"); | |
| 120 | --vp-custom-block-info-border: theme("colors.brand.800"); | |
| 121 | --vp-custom-block-info-text: theme("colors.brand.200"); | |
| 122 | --vp-custom-block-info-text-deep: theme("colors.brand.200"); | |
| 119 | --vp-custom-block-info-bg: color-mix(in srgb, var(--vp-c-brand-1) 10%, transparent); | |
| 120 | --vp-custom-block-info-border: var(--vp-c-brand-3); | |
| 121 | --vp-custom-block-info-text: var(--vp-c-brand-1); | |
| 122 | --vp-custom-block-info-text-deep: var(--vp-c-brand-1); | |
| 123 | 123 | /** Tip */ |
| 124 | 124 | --vp-custom-block-tip-bg: theme("colors.meadow.950"); |
| 125 | 125 | --vp-custom-block-tip-border: theme("colors.meadow.800"); |
| @@ -606,11 +606,11 @@ table tr:nth-child(odd) { | ||
| 606 | 606 | @apply relative; |
| 607 | 607 | |
| 608 | 608 | .is-link:hover { |
| 609 | @apply bg-brand-800/15! dark:bg-brand-500/15!; | |
| 609 | background-color: var(--vp-c-sidebar-active) !important; | |
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | .is-link.has-active { |
| 613 | @apply bg-brand-800/15! dark:bg-brand-500/15!; | |
| 613 | background-color: var(--vp-c-sidebar-active) !important; | |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | &.collapsible { |
| @@ -1206,7 +1206,8 @@ table tr:nth-child(odd) { | ||
| 1206 | 1206 | @apply pl-0 border-l-0; |
| 1207 | 1207 | |
| 1208 | 1208 | & > .outline-marker { |
| 1209 | @apply z-10 w-0.75 dark:bg-brand-300; | |
| 1209 | @apply z-10 w-0.75; | |
| 1210 | background-color: var(--vp-c-brand-1); | |
| 1210 | 1211 | transition-timing-function: $ease-out-expo; |
| 1211 | 1212 | transition-duration: 0.3s; |
| 1212 | 1213 | } |
| @@ -1234,8 +1235,8 @@ table tr:nth-child(odd) { | ||
| 1234 | 1235 | &:hover, |
| 1235 | 1236 | &:focus, |
| 1236 | 1237 | &.active { |
| 1237 | @apply font-semibold dark:text-brand-300!; | |
| 1238 | color: var(--vp-c-brand-1); | |
| 1238 | @apply font-semibold; | |
| 1239 | color: var(--vp-c-brand-1) !important; | |
| 1239 | 1240 | transition-timing-function: $ease-out-expo; |
| 1240 | 1241 | transition-duration: 0.35s; |
| 1241 | 1242 | } |
| @@ -1250,8 +1251,8 @@ table tr:nth-child(odd) { | ||
| 1250 | 1251 | &:hover, |
| 1251 | 1252 | &:focus, |
| 1252 | 1253 | &.active { |
| 1253 | @apply opacity-100 font-semibold dark:text-brand-300; | |
| 1254 | color: var(--vp-c-brand-1); | |
| 1254 | @apply opacity-100 font-semibold; | |
| 1255 | color: var(--vp-c-brand-1) !important; | |
| 1255 | 1256 | transition-timing-function: $ease-out-expo; |
| 1256 | 1257 | transition-duration: 0.35s; |
| 1257 | 1258 | } |