From 7b25e230c6aed77dfa98399ce896261d7d6e5bda Mon Sep 17 00:00:00 2001 From: bymyself Date: Tue, 24 Jun 2025 18:20:10 -0700 Subject: [PATCH] [feat] Add slot type color definitions - Centralized color mapping for node connection types - Supports all ComfyUI slot types (model, clip, vae, etc.) - Provides default fallback color --- src/constants/slotColors.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/constants/slotColors.ts diff --git a/src/constants/slotColors.ts b/src/constants/slotColors.ts new file mode 100644 index 000000000..797bd94f5 --- /dev/null +++ b/src/constants/slotColors.ts @@ -0,0 +1,30 @@ +/** + * Default colors for node slot types + * Mirrors LiteGraph's slot_default_color_by_type + */ +export const SLOT_TYPE_COLORS: Record = { + number: '#AAD', + string: '#DCA', + boolean: '#DAA', + vec2: '#ADA', + vec3: '#ADA', + vec4: '#ADA', + color: '#DDA', + image: '#353', + latent: '#858', + conditioning: '#FFA', + control_net: '#F8F', + clip: '#FFD', + vae: '#F82', + model: '#B98', + '*': '#AAA' // Default color +} + +/** + * Get the color for a slot type + */ +export function getSlotColor(type?: string | number | null): string { + if (!type) return SLOT_TYPE_COLORS['*'] + const typeStr = String(type).toLowerCase() + return SLOT_TYPE_COLORS[typeStr] || SLOT_TYPE_COLORS['*'] +}