Mods, move this if this is the wrong section. This definitely isn't a plugin on it's own but wanted to share it anyways.
Since MV now uses Hex values for colors, here's a snippet that can convert RGB to Hex. Makes things friendlier for devs and end users.
Usage:
Since MV now uses Hex values for colors, here's a snippet that can convert RGB to Hex. Makes things friendlier for devs and end users.
Code:
function toHex(n) { n = parseInt(n,10); if (isNaN(n)) return "00"; n = Math.max(0,Math.min(n,255)); return "0123456789ABCDEF".charAt((n-n%16)/16) + "0123456789ABCDEF".charAt(n%16);}; function rgbToHex(rgb) { nrgb = rgb.replace(/\s+/g, ''); nrgb = nrgb.split(','); return ("#" + toHex(nrgb[0]) + toHex(nrgb[1]) + toHex(nrgb[2]));};
Code:
var rgb_value = "255, 0, 255"; // Uses string format for plugin propertiesvar hex_value = rgbToHex(rgb_value) // Outputs #FF00FF