@@ -8,6 +8,8 @@ import { CommandDefinition, PropertyDefinition } from '../../types';
88import { SkitCommand } from '../../types' ;
99import { formatCommandPreview } from '../../utils/commandFormatting' ;
1010import { ColorPicker } from '../ui/color-picker' ;
11+ import { HexColorPicker } from 'react-colorful' ;
12+ import { Popover , PopoverContent , PopoverTrigger } from '../ui/popover' ;
1113import { VectorInput } from '../ui/vector-input' ;
1214import { useTranslation } from 'react-i18next' ;
1315import { useCommandTranslation } from '../../hooks/useCommandTranslation' ;
@@ -98,6 +100,10 @@ export function CommandEditor() {
98100 const isBgMixed = ! backgroundColors . every ( c => c === backgroundColors [ 0 ] ) ;
99101 const bgColorValue = isBgMixed ? "#ffffff" : backgroundColors [ 0 ] ;
100102
103+ const labelColors = selectedCommands . map ( cmd => cmd . commandLabelColor || ( commandsMap . get ( cmd . type ) ?. defaultCommandLabelColor ?? "#000000" ) ) ;
104+ const isLabelColorMixed = ! labelColors . every ( c => c === labelColors [ 0 ] ) ;
105+ const labelColorValue = isLabelColorMixed ? "#000000" : labelColors [ 0 ] ;
106+
101107 const selectedLabels = selectedCommands . map ( cmd => commandsMap . get ( cmd . type ) ?. label || cmd . type ) ;
102108 const uniqueLabels = Array . from ( new Set ( selectedLabels ) ) ;
103109
@@ -111,15 +117,55 @@ export function CommandEditor() {
111117 </ CardTitle >
112118 </ CardHeader >
113119 < CardContent className = "space-y-4" >
114- { /* Background Color Picker */ }
120+ { /* Color Pickers - Inline Side by Side */ }
115121 < div className = "space-y-2" >
116- < Label htmlFor = "backgroundColor" > { t ( 'editor.backgroundColor' ) } </ Label >
117- < ColorPicker
118- value = { bgColorValue }
119- onChange = { ( value ) => handlePropertyChange ( "backgroundColor" , value ) }
120- placeholder = { isBgMixed ? '-' : undefined }
121- isMixed = { isBgMixed }
122- />
122+ < div className = "flex items-center gap-6" >
123+ { /* Background Color Picker */ }
124+ < div className = "flex items-center gap-2" >
125+ < Label htmlFor = "backgroundColor" className = "min-w-[60px]" > { t ( 'editor.backgroundColor' ) } </ Label >
126+ < Popover >
127+ < PopoverTrigger asChild >
128+ < button
129+ className = "w-8 h-8 rounded border border-zinc-200 dark:border-zinc-800 cursor-pointer"
130+ style = { { backgroundColor : bgColorValue } }
131+ aria-label = "Pick background color"
132+ />
133+ </ PopoverTrigger >
134+ < PopoverContent className = "w-auto p-3" >
135+ < HexColorPicker color = { bgColorValue } onChange = { ( value ) => handlePropertyChange ( "backgroundColor" , value ) } />
136+ </ PopoverContent >
137+ </ Popover >
138+ < Input
139+ value = { isBgMixed ? '' : bgColorValue }
140+ onChange = { ( e ) => handlePropertyChange ( "backgroundColor" , e . target . value ) }
141+ placeholder = { isBgMixed ? '-' : undefined }
142+ className = "w-28"
143+ />
144+ </ div >
145+
146+ { /* Command Label Color Picker */ }
147+ < div className = "flex items-center gap-2" >
148+ < Label htmlFor = "commandLabelColor" className = "min-w-[60px]" > { t ( 'editor.commandLabelColor' ) } </ Label >
149+ < Popover >
150+ < PopoverTrigger asChild >
151+ < button
152+ className = "w-8 h-8 rounded border border-zinc-200 dark:border-zinc-800 cursor-pointer"
153+ style = { { backgroundColor : labelColorValue } }
154+ aria-label = "Pick text color"
155+ />
156+ </ PopoverTrigger >
157+ < PopoverContent className = "w-auto p-3" >
158+ < HexColorPicker color = { labelColorValue } onChange = { ( value ) => handlePropertyChange ( "commandLabelColor" , value ) } />
159+ </ PopoverContent >
160+ </ Popover >
161+ < Input
162+ value = { isLabelColorMixed ? '' : labelColorValue }
163+ onChange = { ( e ) => handlePropertyChange ( "commandLabelColor" , e . target . value ) }
164+ placeholder = { isLabelColorMixed ? '-' : undefined }
165+ className = "w-28"
166+ />
167+ </ div >
168+ </ div >
123169 </ div >
124170
125171 { /* Command Properties */ }
0 commit comments