color picker: add alpha

This commit is contained in:
bordun 2020-09-06 16:32:13 +02:00
parent c9b0a8a16f
commit 580bd765f6
2 changed files with 12 additions and 7 deletions

View file

@ -19,17 +19,17 @@ class ColorPicker extends UiWidget {
this.rgb = new Rgb({props: {
...Rgb.defaults()._props(),
type: 'rgb',
label: false,
width: 'auto',
height: 'auto',
alphaStroke: 0,
snap: true,
alpha: true
}, parent: this})
this.rgb.container.classList.add('not-editable')
this.modal = new UiModal({
width: 280,
height: 280,
height: 320,
closable: true,
title: '',
hide: true,
@ -108,7 +108,9 @@ class ColorPicker extends UiWidget {
setValue(v) {
this.rgb.setValue(chroma(v).rgb())
if (v === 'transparent') v = '#00000000'
this.rgb.setValue(chroma(v).rgba())
}

View file

@ -287,7 +287,7 @@ osc-inspector-color {
background: var(--color-background);
flex: 1;
width: auto;
margin: 8rem;
--widget-padding: #{$padding};
}
.actions {
@ -298,14 +298,17 @@ osc-inspector-color {
height: 42rem + $padding * 2;
line-height: 38rem;
flex-shrink: 0;
border: $padding solid var(--color-ui-background);
padding: 1rem;
background: var(--color-ui-background);
padding: $padding;
.btn {
flex: 1;
margin: 1rem;;
text-overflow: clip;
min-width: 0;
background: var(--color-ui-button);
margin-right: $padding;
&:last-child {
margin: 0;
}
}
}