AS3 Uint Colour Util – Update: Now with source
12 years ago
Since Flash works with colour in the hex format, I’m always finding it annoying how you have to convert to RGB to perform manipulations on colours. Most colour classes out there like Grant Skinners Color Matrix and the ColorMatrix by Quasimondo work with matrices and the ColourTransform class, which is OK sometimes. But I find they can be overly complicated when you just want to take a hex, do something to it, and then get a another hex in return which can be easily applied to anything you need. After a lot of research I couldn’t find anything that just works with taking and returning raw uints. So I decided to take it upon myself to make a class where you can pass in uints and get uints in return.
What I came up with is the ColourUtil class. I guess it’s kind of like StringUtil classes you see around the place which take a string, manipulate it and return another string. Except my class takes a colour in the form of a uint, and returns a uint. The class is still a work in progress but I have made a little demo below.