Skip to content

Commit

Permalink
fix: background parsing color #9559 (#9560)
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed Sep 22, 2021
1 parent 889f6d7 commit 3e21748
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/core/css/parser.ts
Expand Up @@ -23,7 +23,7 @@ export interface LinearGradient {
colors: ColorStop[];
}
export interface Background {
readonly color?: number;
readonly color?: number | Color;
readonly image?: URL | LinearGradient;
readonly repeat?: BackgroundRepeat;
readonly position?: BackgroundPosition;
Expand Down
5 changes: 4 additions & 1 deletion packages/core/ui/styling/style-properties.ts
Expand Up @@ -838,7 +838,10 @@ backgroundPositionProperty.register(Style);
function convertToBackgrounds(this: void, value: string): [CssProperty<any, any>, any][] {
if (typeof value === 'string') {
const backgrounds = parser.parseBackground(value).value;
const backgroundColor = backgrounds.color ? new Color(backgrounds.color) : unsetValue;
let backgroundColor = unsetValue;
if (backgrounds.color) {
backgroundColor = backgrounds.color instanceof Color ? backgrounds.color : new Color(backgrounds.color);
}

let backgroundImage: string | LinearGradient;
if (typeof backgrounds.image === 'object' && backgrounds.image) {
Expand Down

0 comments on commit 3e21748

Please sign in to comment.