package util; import haxe.Exception; import cc.Colors; enum Color { White; Orange; Magenta; LightBlue; Yellow; Lime; Pink; Gray; Grey; LightGray; LightGrey; Cyan; Purple; Blue; Brown; Green; Red; Black; } class ColorConvert { public static function colorToCC(color:Color):cc.Colors.Color { switch color { case White: return Colors.white; case Orange: return Colors.orange; case Magenta: return Colors.magenta; case LightBlue: return Colors.lightBlue; case Yellow: return Colors.yellow; case Lime: return Colors.lime; case Pink: return Colors.pink; case Gray: return Colors.gray; case Grey: return Colors.grey; case LightGray: return Colors.lightGray; case LightGrey: return Colors.lightGrey; case Cyan: return Colors.cyan; case Purple: return Colors.purple; case Blue: return Colors.blue; case Brown: return Colors.brown; case Green: return Colors.green; case Red: return Colors.red; case Black: return Colors.black; }; } public static function ccToColor(color:cc.Colors.Color):Color { switch color { case 0: return White; case 1: return Orange; case 2: return Magenta; case 3: return LightBlue; case 4: return Yellow; case 5: return Lime; case 6: return Pink; case 7: return Gray; case 8: return Grey; case 9: return LightGray; case 10: return LightGrey; case 11: return Cyan; case 12: return Purple; case 13: return Blue; case 14: return Brown; case 15: return Green; case 16: return Red; case 17: return Black; case _: throw new Exception("Invalid input"); } } }