Skip to content

Commit

Permalink
[FIX] chart_scorecard: adjusted title and baseline description colors
Browse files Browse the repository at this point in the history
Earlier color of the chart title and description in the Scorecard were shades of
grey, that's why they appeared too similar upon change of background. A slight
tweak in color shades fixed this issue.

Task-3216001

closes #2211

X-original-commit: 27d5cdf
Signed-off-by: Rémi Rahir (rar) <[email protected]>
  • Loading branch information
dhrp-odoo committed Mar 13, 2023
1 parent c8dd315 commit 8b1620b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/components/figures/chart/scorecard/chart_scorecard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class ScorecardChart extends Component<Props, SpreadsheetChildEnv> {
}

get secondaryFontColor() {
return relativeLuminance(this.primaryFontColor) <= 0.3 ? "#757575" : "#bbbbbb";
return relativeLuminance(this.backgroundColor) > 0.3 ? "#525252" : "#C8C8C8";
}

get figure() {
Expand Down
8 changes: 4 additions & 4 deletions tests/components/__snapshots__/scorecard_chart.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exports[`Scorecard charts Scorecard snapshot 1`] = `
>
<div
class="o-title-text"
style="font-size:18px; display:inline-block; color:#757575;"
style="font-size:18px; display:inline-block; color:#525252;"
>
hello
</div>
Expand Down Expand Up @@ -58,7 +58,7 @@ exports[`Scorecard charts Scorecard snapshot 1`] = `
<span
class="o-baseline-text-description"
style="font-size:33.55526293945314px; display:inline-block; color:#757575;"
style="font-size:33.55526293945314px; display:inline-block; color:#525252;"
>
description
</span>
Expand Down Expand Up @@ -119,7 +119,7 @@ exports[`Scorecard charts scorecard text is resized while figure is resized 1`]
>
<div
class="o-title-text"
style="font-size:18px; display:inline-block; color:#757575;"
style="font-size:18px; display:inline-block; color:#525252;"
>
hello
</div>
Expand Down Expand Up @@ -162,7 +162,7 @@ exports[`Scorecard charts scorecard text is resized while figure is resized 1`]
<span
class="o-baseline-text-description"
style="font-size:14.764795898437502px; display:inline-block; color:#757575;"
style="font-size:14.764795898437502px; display:inline-block; color:#525252;"
>
description
</span>
Expand Down
10 changes: 5 additions & 5 deletions tests/components/scorecard_chart.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ describe("Scorecard charts", () => {

expect(getChartElement()).toBeTruthy();
expect(getChartBaselineTextContent()).toEqual("1");
expect(toHex(getChartBaselineTextElement()!.style["color"])).toEqual("#757575");
expect(toHex(getChartBaselineTextElement()!.style["color"])).toEqual("#525252");
});

test("Key < baseline display in red with down arrow", async () => {
Expand All @@ -199,7 +199,7 @@ describe("Scorecard charts", () => {

const baselineElement = getChartBaselineElement();
expect(baselineElement.querySelector("svg")).toBeFalsy();
expect(toHex(baselineElement.querySelector("span")!.style["color"])).toEqual("#757575");
expect(toHex(baselineElement.querySelector("span")!.style["color"])).toEqual("#525252");
expect(getChartBaselineTextContent()).toEqual("0");
});

Expand Down Expand Up @@ -312,9 +312,9 @@ describe("Scorecard charts", () => {
chartId
);

expect(toHex(getChartTitleElement()!.style["color"])).toEqual("#BBBBBB");
expect(toHex(getChartBaselineTextElement()!.style["color"])).toEqual("#BBBBBB");
expect(toHex(getChartBaselineDescrElement()!.style["color"])).toEqual("#BBBBBB");
expect(toHex(getChartTitleElement()!.style["color"])).toEqual("#C8C8C8");
expect(toHex(getChartBaselineTextElement()!.style["color"])).toEqual("#C8C8C8");
expect(toHex(getChartBaselineDescrElement()!.style["color"])).toEqual("#C8C8C8");
expect(toHex(getChartKeyElement()!.style["color"])).toEqual("#FFFFFF");
});

Expand Down

0 comments on commit 8b1620b

Please sign in to comment.