diff --git a/src/js/service/palette/reader/PaletteGplReader.js b/src/js/service/palette/reader/PaletteGplReader.js index c2631654..e8be9f8c 100644 --- a/src/js/service/palette/reader/PaletteGplReader.js +++ b/src/js/service/palette/reader/PaletteGplReader.js @@ -18,6 +18,6 @@ b : parseInt(matches[3], 10) }); - return color.toRgbString(); + return color.toHexString(); }; })(); diff --git a/src/js/service/palette/reader/PalettePalReader.js b/src/js/service/palette/reader/PalettePalReader.js index 6513d7e6..a906fab8 100644 --- a/src/js/service/palette/reader/PalettePalReader.js +++ b/src/js/service/palette/reader/PalettePalReader.js @@ -11,7 +11,9 @@ ns.PalettePalReader.prototype.extractColorFromLine = function (line) { var matches = line.match(RE_COLOR_LINE); - var color = 'rgb(' + matches[1] + ',' + matches[2] + ',' + matches[3] + ')'; - return color; + var rgbColor = 'rgb(' + matches[1] + ',' + matches[2] + ',' + matches[3] + ')'; + var color = window.tinycolor(rgbColor); + + return color.toHexString(); }; })(); diff --git a/src/js/service/palette/reader/PaletteTxtReader.js b/src/js/service/palette/reader/PaletteTxtReader.js index 94e32aab..dbe532a3 100644 --- a/src/js/service/palette/reader/PaletteTxtReader.js +++ b/src/js/service/palette/reader/PaletteTxtReader.js @@ -12,6 +12,6 @@ ns.PaletteTxtReader.prototype.extractColorFromLine = function (line) { var matches = line.match(RE_COLOR_LINE); var color = '#' + matches[1] + matches[2] + matches[3]; - return color; + return color.toLowerCase(); }; })(); diff --git a/src/js/tools/drawing/Lighten.js b/src/js/tools/drawing/Lighten.js index 3f6e7254..f0cfb98e 100644 --- a/src/js/tools/drawing/Lighten.js +++ b/src/js/tools/drawing/Lighten.js @@ -73,6 +73,6 @@ usedPixels[key] = true; // Convert tinycolor color to string format. - return color.toRgbString(); + return color.toHexString(); }; })(); diff --git a/src/js/widgets/ColorsList.js b/src/js/widgets/ColorsList.js index 3966635f..e5041d6e 100644 --- a/src/js/widgets/ColorsList.js +++ b/src/js/widgets/ColorsList.js @@ -71,10 +71,10 @@ }; ns.ColorsList.prototype.onColorUpdated_ = function (color) { - var rgbColor = color.toRgbString(); - this.colorPreviewEl.style.background = rgbColor; + var strColor = color.toHexString(); + this.colorPreviewEl.style.background = strColor; if (this.palette) { - this.palette.set(this.selectedIndex, rgbColor); + this.palette.set(this.selectedIndex, strColor); this.refreshColorElement_(this.selectedIndex); } }; diff --git a/src/js/worker/framecolors/FrameColorsWorker.js b/src/js/worker/framecolors/FrameColorsWorker.js index 787f0433..45a79479 100644 --- a/src/js/worker/framecolors/FrameColorsWorker.js +++ b/src/js/worker/framecolors/FrameColorsWorker.js @@ -17,7 +17,7 @@ var hexRe = (/^#([a-f0-9]{3}){1,2}$/i); var rgbRe = (/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/i); if (hexRe.test(color)) { - return color.toUpperCase(); + return color.toLowerCase(); } else if (rgbRe.test(color)) { var exec = rgbRe.exec(color); return rgbToHex(exec[1] * 1, exec[2] * 1, exec[3] * 1);