Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
toHexString = function (r, g, b)
var toHexString = function (r, g, b) {
return (toHexString = _toHexString)(r,g,b);
function _toHexString(r, g, b) {
return "#" + toHexByte(r) + toHexByte(g) + toHexByte(b);
function toHexByte(bite) {
var hex = bite.toString(16);
return (hex.length === 2 ? hex : "0" + hex);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.