Grayscale color
My first post 😀 Just testing the syntax highlighting too. It works perfect!
This is how I create a grayscale color in actionscript 3.
grayscale ( 140 );
The function:
/*
* Get a grayscale color from a tint
*
* @param tint Enter tint from range 0 to 255
* @return Gray hexadecimal colorvalue
* @tiptext
*/
public static function grayscale ( tint:uint = 0 ):uint
{
// restriction
if (tint < 0) { tint = 0 }
if (tint > 255) { tint = 255 }
// return calculation of color
return (tint << 16) | (tint << 8) | tint;
}
Feel free to add comment