Skip to content

Commit 5a3e5b7

Browse files
committed
convert rgba to rgb if necessary
1 parent 93da80d commit 5a3e5b7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/widgets/ColorPicker.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,12 @@ class ColorPicker extends Component {
108108
// expect from user data.
109109
const selectedColor = tinycolor(this.props.selectedColor);
110110
const colorText = selectedColor.toHexString();
111-
const rgbString = selectedColor.toRgbString();
111+
112+
// Convert rgba to rgb if necessary
113+
const rgbString =
114+
selectedColor._a !== 0
115+
? selectedColor.toRgbString()
116+
: `rgb(${selectedColor._r},${selectedColor._g},${selectedColor._b})`;
112117

113118
// We need inline style here to assign the background color
114119
// dynamically.

0 commit comments

Comments
 (0)