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%; }