User:Canadabonk/sandbox.js: Difference between revisions
Content deleted Content added
Canadabonk (talk | contribs) No edit summary |
Canadabonk (talk | contribs) No edit summary Tag: Reverted |
||
Line 74:
if (color.match(/^rgb/)) {
rgb = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
r = rgb[1].toString(16);
return (rgb && rgb.length === 4) ? "#" +▼
if (g.length == 1) g = "0" + g;
if (b.length == 1) b = "0" + b;
return "#" + r + g + b;
} else if (color.match(/^#.../)) {
return "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3];
|