HaxeFlixel/flixel — pull request #1181 by JoeCreates (2014-06-15 01:09:29+00:00)
Title: FlxColor changes andthensome. Closes #1179 and closes #1178

Changes included:
* Fix the logo SVG (again). It had gone tiny on android due to size/viewBox mismatch.
* Added `add()`, `multiply()` and `subtract()` to `FlxColor` with respective operator overloading.
* Added `FlxColor#inverted` to get an inverted version of a color.
* Fix a bug with `FlxBitmapTextField` which produced incorrect border colors on native builds.
* Replaced `darken()` and `lighten()` with `darkened()` and `lightened()`, creating new values instead of modifying the old one.

Of these changes, I should probably explain the justification of the last one in particular. I had previously changed the comments but had to do some further research to figure out what the best solution would be.

The problem with the old way stems from the fact that FlxColors are never technically instantiated; they are simply values. When you try to modify a FlxColor by its mutators, you actually change the value in some variable. There are cases you may wish to obtain a lightened, darkened or inverted version of a color without ever having the color stored in a local variable, for example:
```
// These are not possible
bgColor = FlxColor.WHITE.darken();
bgColor = FlxColor.fromRGB(100, 100, 100).darken();

// But these are:
bgColor = FlxColor.WHITE.darkened();
bgColor = FlxColor.fromRGB(100, 100, 100).darkened();
```
Furthermore, this now allows the effects to be applied without changing any value, but still makes it possible to use them to alter an existing color:
```
// Now you can easily retain an original color
newColor = originalColor.darkened();

// But still modify the color if you need to
originalColor = originalColor.darkened();
```
Note that this has no bearing on any of the other mutators, as they all use `=` assignments and will always have a variable available to modify.

I would be open to renaming `darkened()`, `lightened()`, and `inverted()` to something like `getDarkened()`, `getLightened()`, and `getInverted()` if people think those would be more fitting.