Skip to content

Instantly share code, notes, and snippets.

@b4blue
Created February 15, 2016 11:42
Show Gist options
  • Select an option

  • Save b4blue/dd7147f151df6de1d03e to your computer and use it in GitHub Desktop.

Select an option

Save b4blue/dd7147f151df6de1d03e to your computer and use it in GitHub Desktop.
public static function invertRgb(str:String):String {
var hexArray:Array = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F");
var colorBefore:String = str.toUpperCase();
var colorK:String;
for (var n=0; n<6; n++) {
var tempNum = colorBefore.substr(n, 1);
for (var m=0; m<hexArray.length; m++) {
if (tempNum == hexArray[m]) {
var tempArray = hexArray.reverse();
tempNum = tempArray[m];
colorK += tempNum;
}
}
}
return colorK;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment