Skip to content

Commit 3cd5eee

Browse files
committed
[FIX] spreadsheet: dark mode display issues
- Update rotation icons to use `currentColor` so they follow the active theme palette. - Force data bar conditional format preview text to use the dark `TEXT_BODY` color, regardless of theme, as it was previously changing with the theme and becoming hard to read. closes #7533 Task: 5322179 Signed-off-by: Lucas Lefèvre (lul) <[email protected]>
1 parent 97c5b46 commit 3cd5eee

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

src/components/icons/icons.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,34 +1068,40 @@
10681068
xmlns="http://www.w3.org/2000/svg">
10691069
<path
10701070
d="M5 2h1v12h1.5l-2 2-2-2H5m6-5h1v5h1.5l-2 2-2-2H11M8 2l7 2.8V6L8 8.8l-.43-1.12 1.9-.7V3.8l-1.9-.7L8 1.98m2.7 2.25v2.3l2.8-1.1z"
1071+
fill="currentColor"
10711072
/>
10721073
</svg>
10731074
</t>
10741075
<t t-name="o-spreadsheet-Icon.ROTATION-45">
10751076
<svg width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
10761077
<path
10771078
d="m1.95 6.879.707-.707 8.485 8.485 1.06-1.06v2.828H9.375l1.061-1.061m.706-7.778.707-.707 3.536 3.535 1.06-1.06v2.828h-2.828l1.06-1.06M4.071 4.757l6.93-2.97.848.849-2.97 6.93-1.096-.488.849-1.839-2.249-2.248-1.838.848-.488-1.096m3.5-.318 1.626 1.626 1.203-2.757z"
1079+
fill="currentColor"
10781080
/>
10791081
</svg>
10801082
</t>
10811083
<t t-name="o-spreadsheet-Icon.ROTATION-90">
10821084
<svg width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
10831085
<path
10841086
d="M5 2h1v12h1.5l-2 2-2-2H5m6-5h1v5h1.5l-2 2-2-2H11M8 2l7 2.8V6L8 8.8l-.43-1.12 1.9-.7V3.8l-1.9-.7L8 1.98m2.7 2.25v2.3l2.8-1.1z"
1087+
fill="currentColor"
10851088
/>
10861089
</svg>
10871090
</t>
1091+
10881092
<t t-name="o-spreadsheet-Icon.ROTATION-270">
10891093
<svg width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
10901094
<path
10911095
d="M13 16h-1V4h-1.5l2-2 2 2H13M7 9H6V4H4.5l2-2 2 2H7m3 12-7-2.8V12l7-2.8.43 1.12-1.9.7v3.18l1.9.7-.43 1.12m-2.7-2.25v-2.3l-2.8 1.1z"
1096+
fill="currentColor"
10921097
/>
10931098
</svg>
10941099
</t>
10951100
<t t-name="o-spreadsheet-Icon.ROTATION-315">
10961101
<svg width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
10971102
<path
10981103
d="m6.879 16.55-.707-.707 8.485-8.485-1.06-1.06h2.828v2.828l-1.061-1.061m-7.778-.707-.707-.707 3.535-3.536-1.06-1.06h2.828v2.828l-1.06-1.06M4.757 14.429l-2.97-6.93.849-.848 6.93 2.97-.488 1.096-1.839-.849-2.248 2.249.848 1.838-1.096.488m-.318-3.5 1.626-1.626-2.757-1.203z"
1104+
fill="currentColor"
10991105
/>
11001106
</svg>
11011107
</t>

src/components/side_panel/conditional_formatting/cf_preview/cf_preview.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ICONS } from "@odoo/o-spreadsheet-engine/components/icons/icons";
22
import { CfTerms } from "@odoo/o-spreadsheet-engine/components/translations_terms";
3-
import { HIGHLIGHT_COLOR } from "@odoo/o-spreadsheet-engine/constants";
3+
import { HIGHLIGHT_COLOR, TEXT_BODY } from "@odoo/o-spreadsheet-engine/constants";
44
import { criterionEvaluatorRegistry } from "@odoo/o-spreadsheet-engine/registries/criterion_registry";
55
import { SpreadsheetChildEnv } from "@odoo/o-spreadsheet-engine/types/spreadsheet_env";
66
import { Component, useRef } from "@odoo/owl";
@@ -40,8 +40,9 @@ export class ConditionalFormatPreview extends Component<Props, SpreadsheetChildE
4040
? baseString + minColor + ", " + midColor + ", " + maxColor + ")"
4141
: baseString + minColor + ", " + maxColor + ")";
4242
} else if (rule.type === "DataBarRule") {
43-
const color = colorNumberToHex(rule.color);
44-
return `background-image: linear-gradient(to right, ${color} 50%, white 50%)`;
43+
const barColor = colorNumberToHex(rule.color);
44+
const gradient = `background-image: linear-gradient(to right, ${barColor} 50%, white 50%)`;
45+
return `${gradient}; color: ${TEXT_BODY};`;
4546
}
4647
return "";
4748
}

tests/__snapshots__/top_bar_component.test.ts.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ exports[`TopBar component simple rendering 1`] = `
610610
>
611611
<path
612612
d="M5 2h1v12h1.5l-2 2-2-2H5m6-5h1v5h1.5l-2 2-2-2H11M8 2l7 2.8V6L8 8.8l-.43-1.12 1.9-.7V3.8l-1.9-.7L8 1.98m2.7 2.25v2.3l2.8-1.1z"
613+
fill="currentColor"
613614
/>
614615
</svg>
615616
</span>

tests/spreadsheet/__snapshots__/spreadsheet_component.test.ts.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ exports[`Simple Spreadsheet Component simple rendering snapshot 1`] = `
618618
>
619619
<path
620620
d="M5 2h1v12h1.5l-2 2-2-2H5m6-5h1v5h1.5l-2 2-2-2H11M8 2l7 2.8V6L8 8.8l-.43-1.12 1.9-.7V3.8l-1.9-.7L8 1.98m2.7 2.25v2.3l2.8-1.1z"
621+
fill="currentColor"
621622
/>
622623
</svg>
623624
</span>
@@ -1670,6 +1671,7 @@ exports[`components take the small screen into account 1`] = `
16701671
>
16711672
<path
16721673
d="M5 2h1v12h1.5l-2 2-2-2H5m6-5h1v5h1.5l-2 2-2-2H11M8 2l7 2.8V6L8 8.8l-.43-1.12 1.9-.7V3.8l-1.9-.7L8 1.98m2.7 2.25v2.3l2.8-1.1z"
1674+
fill="currentColor"
16731675
/>
16741676
</svg>
16751677
</span>

0 commit comments

Comments
 (0)