Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions packages/uui-color-picker/lib/uui-color-picker.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) {
@state() private hue = 0;
@state() private saturation = 0;
@state() private lightness = 0;
@state() private alpha = 0;
@state() private alpha = 100;
@state() private _colord: Colord = colord('hsl(0, 0%, 0%)');

/**
Expand Down Expand Up @@ -361,7 +361,7 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) {
if (colorString === this.value) return;

if (!colorString) {
this.alpha = 0;
this.alpha = 100;
this.inputValue = '';
this._value = colorString;

Expand All @@ -379,7 +379,7 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) {
this.hue = h;
this.saturation = s;
this.lightness = l;
this.alpha = this.opacity ? a * 100 : 100;
this.alpha = this.opacity ? a * 100 : 100; // Convert to 0-100 range, and set alpha to 100 if opacity is disabled

const hslaColor = colorString as HslaColor;

Expand All @@ -395,7 +395,6 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) {
this.dispatchEvent(
new UUIColorPickerChangeEvent(UUIColorPickerChangeEvent.CHANGE),
);

return true;
}

Expand Down
1 change: 1 addition & 0 deletions packages/uui-color-picker/lib/uui-color-picker.story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const Inline: Story = {
export const Opacity: Story = {
args: {
opacity: true,
value: undefined,
inline: true,
},
};
Expand Down
Loading