fix(color): support web standard #rrggbbaa format

original pr credit to @farfromrefug
https://github.com/NativeScript/NativeScript/pull/8519

BREAKING CHANGE

Long standing inconsistency with color handling here.

BEFORE:

```
// #aarrggbb

const color = new Color('#ff00ff00');

Label {
    background-color: #ff00ff00;
}
```

AFTER:

```
// #rrggbbaa

const color = new Color('#00ff00ff');

Label {
    background-color: #00ff00ff;
}
```
This commit is contained in:
Nathan Walker
2021-03-06 20:27:29 -08:00
parent e9b5eb934d
commit aaeab990c8
10 changed files with 36 additions and 28 deletions

View File

@ -270,11 +270,11 @@ export var testHintColoriOS = function () {
actualValue = textViewTestsNative.getNativeColor(textView).hex;
TKUnit.assertEqual(actualValue, '#38FF0000', 'Expected hint color to be a subtle transparent red: #38FF0000');
TKUnit.assertEqual(actualValue, '#FF000038', 'Expected hint color to be a subtle transparent red: #FF000038');
textView.text = 'text';
expectedValue = '#FFFF0000'; // red
expectedValue = '#FF0000FF'; // red
expectedNormalizedValue = '#FF0000';
actualValue = textViewTestsNative.getNativeColor(textView).hex;
TKUnit.assert(actualValue === expectedNormalizedValue, 'Actual: ' + actualValue + '; Expected: ' + expectedNormalizedValue);
@ -403,7 +403,7 @@ export var testLocalLineHeightFromCss = function () {
});
};
var expectedColorHex = '#FFFF0000';
var expectedColorHex = '#FF0000FF';
var expectedNormalizedColorHex = '#FF0000';
export var testLocalColorFromCss = function () {
helper.buildUIAndRunTest(_createTextViewFunc(), function (views: Array<viewModule.View>) {
@ -437,7 +437,7 @@ export var testNativeColorFromLocal = function () {
});
};
var expectedBackgroundColorHex = '#FF00FF00';
var expectedBackgroundColorHex = '#00FF00FF';
var expectedNormalizedBackgroundColorHex = '#00FF00';
export var testLocalBackgroundColorFromCss = function () {
helper.buildUIAndRunTest(_createTextViewFunc(), function (views: Array<viewModule.View>) {