Skip to content

Commit 3e9ecbb

Browse files
Add a missing prepareColor function call in text background color (#303)
1 parent e62a40d commit 3e9ecbb

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

__TESTS__/unit/actions/Overlay.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {Format, png} from "../../../src/values/format";
1010
import {Underlay} from "../../../src/actions/underlay";
1111
import {Timeline} from "../../../src/values/timeline";
1212
import {base64Encode} from "../../../src/internal/utils/base64Encode";
13+
import {TextStyle} from "../../../src/values/textStyle";
1314

1415
describe('Tests for overlay actions', () => {
1516
it('Tests Image on Image with publicID encoding', () => {
@@ -82,6 +83,18 @@ describe('Tests for overlay actions', () => {
8283
expect(asset.toString()).toBe(`b_red,co_blue,l_text:${textStyle.toString()}:Testing/fl_layer_apply`);
8384
});
8485

86+
it('Tests text on image with RGB backgroundColor', () => {
87+
const asset = createNewImage();
88+
89+
asset.overlay(Overlay.source(
90+
Source.text('Testing', new TextStyle('arial', 15))
91+
.backgroundColor('#FEB61FC2')
92+
.textColor('blue')
93+
));
94+
95+
expect(asset.toString()).toBe(`b_rgb:FEB61FC2,co_blue,l_text:arial_15:Testing/fl_layer_apply`);
96+
});
97+
8598
it('Tests nested subtitles on image', () => {
8699
const asset = createNewImage();
87100
const textStyle = sampleTextStyle();

src/values/source/sourceTypes/BaseTextSource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class BaseTextSource extends BaseSource {
5656

5757
tmpAction.addQualifier(new Qualifier(layerType, layerParam));
5858
this._textColor && tmpAction.addQualifier(new Qualifier('co', prepareColor(this._textColor)));
59-
this._backgroundColor && tmpAction.addQualifier(new Qualifier('b', this._backgroundColor));
59+
this._backgroundColor && tmpAction.addQualifier(new Qualifier('b', prepareColor(this._backgroundColor)));
6060

6161
return tmpAction.toString();
6262
}

0 commit comments

Comments
 (0)