Skip to content

Commit a3481a4

Browse files
committed
Use existing palette mechanism to add contrasting colour
1 parent 2e7d50e commit a3481a4

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

dotcom-rendering/src/components/FootballMatchStat.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,8 @@ const decideContrastRequired = (colour: string) => {
9898
const addContrastingBorderCss = (colour: string) => {
9999
const mode = decideContrastRequired(colour);
100100
if (mode === 'none') return null;
101-
102101
return css`
103-
/* stylelint-disable-next-line media-query-no-invalid */
104-
@media (prefers-color-scheme: ${mode}) {
105-
border: 1px solid ${palette('--football-match-stat-border')};
106-
}
107-
[data-color-scheme='${mode}'] & {
108-
border: 1px solid ${palette('--football-match-stat-border')};
109-
}
102+
border: 1px solid ${palette(`--football-match-stat-contrast-${mode}`)};
110103
`;
111104
};
112105

dotcom-rendering/src/paletteDeclarations.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7124,6 +7124,14 @@ const paletteColours = {
71247124
light: () => '#00679E', // replace with Source's `calculateHoverColour` when available
71257125
dark: () => '#00A1E6',
71267126
},
7127+
'--football-match-stat-contrast-dark': {
7128+
light: () => 'transparent',
7129+
dark: () => sourcePalette.neutral[46],
7130+
},
7131+
'--football-match-stat-contrast-light': {
7132+
light: () => sourcePalette.neutral[46],
7133+
dark: () => 'transparent',
7134+
},
71277135
'--football-match-stat-text': {
71287136
light: () => sourcePalette.neutral[7],
71297137
dark: () => sourcePalette.neutral[86],

0 commit comments

Comments
 (0)