Skip to content

Commit

Permalink
datawrapper: Use dark background in dark mode
Browse files Browse the repository at this point in the history
At the moment, interactive block components set a white background in
dark mode because interactive embeds are assumed not to handle dark
mode.

This was done in
#10578, later modified
in #10580 to remove
transparency.

This blocks the use of datawrapper’s automatic dark mode, because it
causes it to display dark mode colours on a white background.

This commit changes (only) datawrapper interactive block components to
set a dark background in dark mode, which will let us use datawrapper’s
automatic dark mode.

I wasn’t entirely sure which colours to use: articleBackgroundDark seems
the obvious choice (and is what I’ve gone with), but then why doesn’t
interactiveBlockBackgroundList use articleBackgroundLight?
  • Loading branch information
emdash-ie committed Nov 12, 2024
1 parent 971a25a commit 11ac343
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ const wrapperStyle = ({
isDatawrapperGraphic: boolean;
}) => css`
${format.theme === ArticleSpecial.Labs ? textSans17 : article17}
background-color: ${themePalette('--interactive-block-background')};
background-color: ${themePalette(
isDatawrapperGraphic
? '--interactive-block-background-datawrapper'
: '--interactive-block-background',
)};
min-height: ${getMinHeight(role, loaded)};
position: relative;
display: flex;
Expand Down
4 changes: 4 additions & 0 deletions dotcom-rendering/src/palette.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6551,6 +6551,10 @@ const paletteColours = {
light: interactiveBlockBackgroundLight,
dark: interactiveBlockBackgroundDark,
},
'--interactive-block-background-datawrapper': {
light: interactiveBlockBackgroundLight,
dark: articleBackgroundDark,
},
'--interactive-contents-hover': {
light: interactiveContentsHoverLight,
dark: interactiveContentsHoverDark,
Expand Down

0 comments on commit 11ac343

Please sign in to comment.