@@ -428,6 +428,9 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) {
428428 }
429429
430430 private _renderColorPicker ( ) {
431+ const previewColor = this . value
432+ ? `hsla(${ this . hue } deg, ${ this . saturation } %, ${ this . lightness } %, ${ this . alpha / 100 } )`
433+ : 'transparent' ;
431434 return html `
432435 <div
433436 class= ${ classMap ( {
@@ -478,11 +481,7 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) {
478481 class = "color-picker__preview color-picker__transparent-bg"
479482 title = "Copy"
480483 aria-label = "Copy"
481- style = ${ styleMap ( {
482- '--preview-color' : `hsla(${ this . hue } deg, ${ this . saturation } %, ${
483- this . lightness
484- } %, ${ this . alpha / 100 } )`,
485- } ) }
484+ style = ${ styleMap ( { '--preview-color' : previewColor } ) }
486485 @click = ${ this . handleCopy } > </ butto n>
487486 </ div>
488487 <div class= "color-picker__user-input" aria-live = "polite" >
@@ -547,6 +546,9 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) {
547546 }
548547
549548 private _renderPreviewButton ( ) {
549+ const previewColor = this . value
550+ ? `hsla(${ this . hue } deg, ${ this . saturation } %, ${ this . lightness } %, ${ this . alpha / 100 } )`
551+ : 'transparent' ;
550552 return html `<butto n
551553 type= "button"
552554 part = "trigger"
@@ -559,11 +561,7 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) {
559561 'color-dropdown__trigger--large' : this . size === 'large' ,
560562 'color-picker__transparent-bg' : true ,
561563 } ) }
562- style= ${ styleMap ( {
563- '--preview-color' : `hsla(${ this . hue } deg, ${ this . saturation } %, ${
564- this . lightness
565- } %, ${ this . alpha / 100 } )`,
566- } ) }
564+ style= ${ styleMap ( { '--preview-color' : previewColor } ) }
567565 ?dis abled= ${ this . disabled }
568566 aria- has popup= "true"
569567 aria- expand ed= "false"
0 commit comments