mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Merge pull request #343 from juliandescottes/fix-color-format
Issue #332 : always use lowercase hexstring format for colors
This commit is contained in:
commit
26f4448175
@ -18,6 +18,6 @@
|
||||
b : parseInt(matches[3], 10)
|
||||
});
|
||||
|
||||
return color.toRgbString();
|
||||
return color.toHexString();
|
||||
};
|
||||
})();
|
||||
|
@ -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();
|
||||
};
|
||||
})();
|
||||
|
@ -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();
|
||||
};
|
||||
})();
|
||||
|
@ -73,6 +73,6 @@
|
||||
usedPixels[key] = true;
|
||||
|
||||
// Convert tinycolor color to string format.
|
||||
return color.toRgbString();
|
||||
return color.toHexString();
|
||||
};
|
||||
})();
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user