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

@@ -514,7 +514,7 @@ export var testNativeFontSizeFromLocal = function () {
});
};
var expectedColorHex = '#FFFF0000';
var expectedColorHex = '#FF0000FF';
var expectedNormalizedColorHex = '#FF0000';
export var testLocalColorFromCss = function () {
helper.buildUIAndRunTest(_createTextFieldFunc(), function (views: Array<View>) {
@@ -548,7 +548,7 @@ export var testNativeColorFromLocal = function () {
});
};
var expectedBackgroundColorHex = '#FF00FF00';
var expectedBackgroundColorHex = '#00FF00FF';
var expectedNormalizedBackgroundColorHex = '#00FF00';
export var testLocalBackgroundColorFromCss = function () {
helper.buildUIAndRunTest(_createTextFieldFunc(), function (views: Array<View>) {
@@ -695,7 +695,7 @@ export function test_IntegrationTest_Transform_Decoration_Spacing_WithFormattedT
export function test_set_placeholder_color() {
const view = new TextField();
const expectedColorHex = '#FFFF0000';
const expectedColorHex = '#FF0000FF';
const expectedNormalizedColorHex = '#FF0000';
helper.buildUIAndRunTest(view, function (views: Array<View>) {
view.hint = 'Some text for hint';
@@ -707,7 +707,7 @@ export function test_set_placeholder_color() {
export function test_set_placeholder_color_when_hint_is_not_set() {
const view = new TextField();
const expectedColorHex = '#FFFF0000';
const expectedColorHex = '#FF0000FF';
const expectedNormalizedColorHex = '#FF0000';
helper.buildUIAndRunTest(view, function (views: Array<View>) {
view.setInlineStyle('placeholder-color: ' + expectedColorHex + ';');