From 8d35d4dbaf8f94efa628eeed07dc5b833cc94584 Mon Sep 17 00:00:00 2001 From: Danila Poyarkov Date: Sat, 28 Feb 2026 09:08:40 +0300 Subject: [PATCH] Deduplicate hex formatting: colorToHexRaw() in engine/color.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes duplicate hexString() wrappers from FillSection, StrokeSection, and ColorPicker — all now use culori-based colorToHexRaw(). --- src/components/ColorPicker.vue | 4 ++-- src/components/properties/FillSection.vue | 8 ++------ src/components/properties/StrokeSection.vue | 8 ++------ src/engine/color.ts | 4 ++++ 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/components/ColorPicker.vue b/src/components/ColorPicker.vue index 0e087cb0d..6e55d6304 100644 --- a/src/components/ColorPicker.vue +++ b/src/components/ColorPicker.vue @@ -2,7 +2,7 @@ import { ref, computed, watch } from 'vue' import { PopoverRoot, PopoverTrigger, PopoverPortal, PopoverContent } from 'reka-ui' -import { colorToHex, parseColor } from '../engine/color' +import { colorToHexRaw, parseColor } from '../engine/color' import type { Color } from '../types' @@ -74,7 +74,7 @@ function emitColor() { } const hexValue = computed(() => { - return colorToHex(props.color).slice(1) + return colorToHexRaw(props.color) }) function onHexInput(e: Event) { diff --git a/src/components/properties/FillSection.vue b/src/components/properties/FillSection.vue index be4643afc..f76e7f720 100644 --- a/src/components/properties/FillSection.vue +++ b/src/components/properties/FillSection.vue @@ -2,17 +2,13 @@ import ColorPicker from '../ColorPicker.vue' import { useEditorStore } from '../../stores/editor' import { DEFAULT_SHAPE_FILL } from '../../constants' -import { colorToHex, parseColor } from '../../engine/color' +import { colorToHexRaw, parseColor } from '../../engine/color' import type { Color, Fill } from '../../engine/scene-graph' const props = defineProps<{ nodeId: string; fills: Fill[] }>() const store = useEditorStore() -function hexString(c: Color) { - return colorToHex(c).slice(1).toUpperCase() -} - function updateColor(index: number, color: Color) { const fills = [...props.fills] fills[index] = { ...fills[index], color } @@ -56,7 +52,7 @@ function remove(index: number) { import ColorPicker from '../ColorPicker.vue' import { useEditorStore } from '../../stores/editor' -import { colorToHex, parseColor } from '../../engine/color' +import { colorToHexRaw, parseColor } from '../../engine/color' import type { Color, Stroke } from '../../engine/scene-graph' const props = defineProps<{ nodeId: string; strokes: Stroke[] }>() const store = useEditorStore() -function hexString(c: Color) { - return colorToHex(c).slice(1).toUpperCase() -} - function updateColor(index: number, color: Color) { const strokes = [...props.strokes] strokes[index] = { ...strokes[index], color } @@ -62,7 +58,7 @@ function remove(index: number) {