Merge pull request #460 from juliandescottes/issue458-colorformat

Issue #458: format selected color from spectrum  as HexString
This commit is contained in:
Julian Descottes 2016-04-21 23:52:30 +02:00
commit 85eed8a2e2

View File

@ -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);
}
};