From e3b4fe582ba25d3dcf7bcf04575a7422acebf325 Mon Sep 17 00:00:00 2001 From: orangemug Date: Tue, 7 Mar 2017 09:59:11 +0000 Subject: [PATCH] Fixed alpha value slider (fixes #44) --- src/components/fields/ColorField.jsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/fields/ColorField.jsx b/src/components/fields/ColorField.jsx index aaecb16..143cf40 100644 --- a/src/components/fields/ColorField.jsx +++ b/src/components/fields/ColorField.jsx @@ -50,11 +50,20 @@ class ColorField extends React.Component { } get color() { - return Color(this.props.value || '#fff') + return Color(this.props.value || '#fff').rgb() } render() { const offset = this.calcPickerOffset() + var currentColor = this.color.object() + currentColor = { + r: currentColor.r, + g: currentColor.g, + b: currentColor.b, + // Rename alpha -> a for ChromePicker + a: currentColor.alpha + } + const picker =
this.props.onChange(formatColor(c))} />