Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 6b1f8e7

Browse files
fix: init color chart
1 parent daf1813 commit 6b1f8e7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

studio/src/app/components/editor/styles/slide/app-color-chart/app-color-chart.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {SlideChartType} from '../../../../../models/data/slide';
66

77
import {ColorUtils, InitStyleColor} from '../../../../../utils/editor/color.utils';
88
import {ChartUtils} from '../../../../../utils/editor/chart.utils';
9+
import {hexToRgb} from '@deckdeckgo/utils';
910

1011
enum ApplyColorType {
1112
FILL,
@@ -52,9 +53,9 @@ export class AppColorDeckSlide {
5253
}
5354

5455
if (this.applyColorType === ApplyColorType.FILL) {
55-
return ColorUtils.splitColor(this.selectedElement.style.getPropertyValue(`--deckgo-chart-fill-color-${this.colorIndex}`));
56+
return ColorUtils.splitColor(await this.hexOrRgb(this.selectedElement.style.getPropertyValue(`--deckgo-chart-fill-color-${this.colorIndex}`)));
5657
} else if (this.applyColorType === ApplyColorType.STROKE) {
57-
return ColorUtils.splitColor(this.selectedElement.style.getPropertyValue(`--deckgo-chart-stroke-${this.colorIndex}`));
58+
return ColorUtils.splitColor(await this.hexOrRgb(this.selectedElement.style.getPropertyValue(`--deckgo-chart-stroke-${this.colorIndex}`)));
5859
} else if (this.applyColorType === ApplyColorType.AXIS) {
5960
return ColorUtils.splitColor(this.selectedElement.style.getPropertyValue('--deckgo-chart-axis-color'));
6061
} else if (this.applyColorType === ApplyColorType.GRID) {
@@ -64,6 +65,11 @@ export class AppColorDeckSlide {
6465
}
6566
};
6667

68+
private async hexOrRgb(color: string) {
69+
const hexColor: string | undefined = await hexToRgb(color);
70+
return hexColor ? hexColor : color;
71+
}
72+
6773
private async toggleColorType($event: CustomEvent) {
6874
if (!$event || !$event.detail) {
6975
return;

0 commit comments

Comments
 (0)