From 78932048e8a2324049b0ede05b8605f608de47c2 Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Thu, 21 Apr 2016 23:33:19 +0200 Subject: [PATCH] Issue #458: format selected color from spectrum as HexString --- src/js/controller/PaletteController.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/js/controller/PaletteController.js b/src/js/controller/PaletteController.js index 2a2090c5..a3892348 100644 --- a/src/js/controller/PaletteController.js +++ b/src/js/controller/PaletteController.js @@ -48,10 +48,18 @@ */ ns.PaletteController.prototype.onPickerChange_ = function(evt, isPrimary) { var inputPicker = $(evt.target); + var color = inputPicker.val(); + + if (color != Constants.TRANSPARENT_COLOR) { + // Unless the color is TRANSPARENT_COLOR, format it to hexstring, as + // expected by the rest of the application. + color = window.tinycolor(color).toHexString(); + } + if (evt.data.isPrimary) { - this.setPrimaryColor_(inputPicker.val()); + this.setPrimaryColor_(color); } else { - this.setSecondaryColor_(inputPicker.val()); + this.setSecondaryColor_(color); } };