Enhancement palettes : Added download palette

- palettes can be downloaded as GPL palettes
- slightly tweaked the UI of hsl rgb picker
- switched preferred format of spectrum to hex
This commit is contained in:
jdescottes
2014-09-17 01:32:59 +02:00
parent fab9c6e836
commit 8ebdc4cd41
7 changed files with 87 additions and 5 deletions

View File

@ -149,7 +149,16 @@
};
ns.PalettesListController.prototype.downloadSelectedPalette_ = function () {
window.alert('not implemented yet');
// getSelectedPalette
var paletteId = this.colorPaletteSelect_.value;
var palette = this.paletteService.getPaletteById(paletteId);
var paletteWriter = new pskl.service.palette.PaletteGplWriter(palette);
var paletteAsString = paletteWriter.write();
pskl.utils.BlobUtils.stringToBlob(paletteAsString, function(blob) {
pskl.utils.FileUtils.downloadAsFile(blob, palette.name + '.gpl');
}.bind(this), "application/json");
};
ns.PalettesListController.prototype.onColorContainerContextMenu = function (event) {

View File

@ -20,7 +20,8 @@
showInput: true,
showButtons: false,
move : this.setColor.bind(this),
change : this.setColor.bind(this)
change : this.setColor.bind(this),
preferredFormat: 'hex'
});
this.setColor("#000000");