Skip to content

Commit

Permalink
fix: Support alpha colors on FillGradient (#10729)
Browse files Browse the repository at this point in the history
* fix: Support alpha colors on FillGradient

* Update TextStyle.tests.ts
  • Loading branch information
bigtimebuddy authored and Zyie committed Jul 11, 2024
1 parent 4e555a8 commit 51d8bd3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/scene/graphics/shared/fill/FillGradient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class FillGradient implements CanvasGradient

public addColorStop(offset: number, color: ColorSource): this
{
this.gradientStops.push({ offset, color: Color.shared.setValue(color).toHex() });
this.gradientStops.push({ offset, color: Color.shared.setValue(color).toHexa() });
this._styleKey = null;

return this;
Expand Down
6 changes: 3 additions & 3 deletions tests/renderering/text/TextStyle.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ describe('TextStyle', () =>

expect(textStyle._fill.fill).toBeInstanceOf(FillGradient);
expect((textStyle._fill.fill as FillGradient).gradientStops).toEqual([
{ offset: 0, color: '#000000' },
{ offset: 0.5, color: '#ff0000' },
{ offset: 1, color: '#ffffff' },
{ offset: 0, color: '#000000ff' },
{ offset: 0.5, color: '#ff0000ff' },
{ offset: 1, color: '#ffffffff' },
]);
});
});

0 comments on commit 51d8bd3

Please sign in to comment.