From 8fc6b70aa562d584159b1ccfffc1cb759712a1b9 Mon Sep 17 00:00:00 2001 From: Hsi <94444077+Hsiii@users.noreply.github.com> Date: Fri, 19 Jun 2026 22:16:39 +0800 Subject: [PATCH] fix(docs): fix color input clipping (#4488) * fix(docs): cap customizer hex input * fix(docs): use full width color field --- .../theme/components/base/ColorPicker.vue | 12 +++++++++++- .../components/icons/SidebarIconCustomizer.vue | 14 ++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/docs/.vitepress/theme/components/base/ColorPicker.vue b/docs/.vitepress/theme/components/base/ColorPicker.vue index d54fcfc2f..d523ba952 100644 --- a/docs/.vitepress/theme/components/base/ColorPicker.vue +++ b/docs/.vitepress/theme/components/base/ColorPicker.vue @@ -11,6 +11,14 @@ const { isDark } = useData(); const emit = defineEmits(['update:modelValue']); +function limitHexInput(val: string) { + if (val.startsWith('#')) { + return val.slice(0, 9); + } + + return val.slice(0, 8); +} + const value = computed({ get: () => { if (props.modelValue == null || props.modelValue === 'currentColor') { @@ -19,7 +27,7 @@ const value = computed({ return props.modelValue; }, - set: (val) => emit('update:modelValue', val), + set: (val) => emit('update:modelValue', limitHexInput(val)), }); @@ -41,6 +49,7 @@ const value = computed({ class="color-input-text" aria-label="Color picker input" v-model="value" + maxlength="9" placeholder="[default]" /> @@ -91,6 +100,7 @@ const value = computed({ background: transparent; color: var(--vp-c-text-1); font-size: 13px; + font-family: var(--vp-font-family-mono); text-align: left; border-radius: 8px; cursor: text; diff --git a/docs/.vitepress/theme/components/icons/SidebarIconCustomizer.vue b/docs/.vitepress/theme/components/icons/SidebarIconCustomizer.vue index 169d47efb..68b2e50b4 100644 --- a/docs/.vitepress/theme/components/icons/SidebarIconCustomizer.vue +++ b/docs/.vitepress/theme/components/icons/SidebarIconCustomizer.vue @@ -73,13 +73,11 @@ const customizingActive = computed(() => { id="icon-color" label="Color" > - + { } .color-picker { - margin-left: auto; + width: 100%; }