From 580bd765f641e75dac9ce2bcaeccb83c33cf5931 Mon Sep 17 00:00:00 2001 From: bordun Date: Sun, 6 Sep 2020 16:32:13 +0200 Subject: [PATCH] color picker: add alpha --- src/client/ui/ui-colorpicker.js | 8 +++++--- src/scss/ui/inspector.scss | 11 +++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/client/ui/ui-colorpicker.js b/src/client/ui/ui-colorpicker.js index 886a2979..dc7b3576 100644 --- a/src/client/ui/ui-colorpicker.js +++ b/src/client/ui/ui-colorpicker.js @@ -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()) } diff --git a/src/scss/ui/inspector.scss b/src/scss/ui/inspector.scss index 1c8acf02..09a000e5 100644 --- a/src/scss/ui/inspector.scss +++ b/src/scss/ui/inspector.scss @@ -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; + } } }