Skip to content

Instantly share code, notes, and snippets.

@nijikokun
Created August 22, 2011 02:50
Show Gist options
  • Save nijikokun/1161559 to your computer and use it in GitHub Desktop.
Save nijikokun/1161559 to your computer and use it in GitHub Desktop.
Simple RGBA Color manager for JS, Needed for C# style
var Color = {
initialize: function(R, G, B, A){
function verify(i) {
return (!is_int(i) || i < 0 || i > 255) ? 255 : i;
}
this.R = verify(R);
this.G = verify(G);
this.B = verify(B);
this.A = verify(A);
}
};
@nijikokun
Copy link
Author

var start = new Color(255,255,255,255);

etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment