Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datawrapper: Use dark background in dark mode #12831

Merged
merged 4 commits into from
Nov 15, 2024

Conversation

emdash-ie
Copy link
Contributor

@emdash-ie emdash-ie commented Nov 12, 2024

What does this change?

This PR changes (only) datawrapper interactive block components to set a dark background in dark mode, instead of the white background currently set.

Why?

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 PR lets us use the automatic dark mode.

Implementation Notes

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?

Screenshots

Before (auto dark mode on) After (auto dark mode on)
before-auto-dark-on after-auto-dark-on
Before (auto dark mode off) After (auto dark mode off)
before-auto-dark-off after-auto-dark-off
Before (auto dark mode off; live blog) After (auto dark mode off; live blog)
before-auto-dark-off-live-blog after-auto-dark-off-live-blog
Before (auto dark mode on; live blog) After (auto dark mode on; live blog)
before-auto-dark-on-live-blog after-auto-dark-on-live-blog
Before (auto dark mode off; dead blog) After (auto dark mode off; dead blog)
after-auto-dark-off-dead-blog
Before (auto dark mode on; dead blog) After (auto dark mode on; dead blog)
after-auto-dark-on-dead-blog

Note: the “after” is using a local instance of DCR with frontend-CODE, which seems to cause the overlap error with the sidebar behind.

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?
@emdash-ie emdash-ie force-pushed the support-datawrapper-auto-dark-mode branch from 6f6ae34 to 11ac343 Compare November 12, 2024 20:06
Copy link

github-actions bot commented Nov 12, 2024

Size Change: +67 B (+0.01%)

Total Size: 940 kB

ℹ️ View Unchanged
Filename Size Change
dotcom-rendering/dist/1000.client.web.********************.js 999 B 0 B
dotcom-rendering/dist/1026.client.web.********************.js 784 B 0 B
dotcom-rendering/dist/1090.client.web.********************.js 752 B 0 B
dotcom-rendering/dist/1347.client.web.********************.js 3.71 kB 0 B
dotcom-rendering/dist/1391.client.web.********************.js 725 B 0 B
dotcom-rendering/dist/1451.client.web.********************.js 3.34 kB 0 B
dotcom-rendering/dist/1476.client.web.********************.js 784 B 0 B
dotcom-rendering/dist/1667.client.web.********************.js 918 B 0 B
dotcom-rendering/dist/1752.client.web.********************.js 2.87 kB 0 B
dotcom-rendering/dist/1877.client.web.********************.js 2.17 kB 0 B
dotcom-rendering/dist/1919.client.web.********************.js 3.83 kB 0 B
dotcom-rendering/dist/1940.client.web.********************.js 507 B 0 B
dotcom-rendering/dist/1989.client.web.********************.js 4.02 kB 0 B
dotcom-rendering/dist/2145.client.web.********************.js 5.03 kB 0 B
dotcom-rendering/dist/2186.client.web.********************.js 6.17 kB 0 B
dotcom-rendering/dist/2291.client.web.********************.js 22.7 kB 0 B
dotcom-rendering/dist/2310.client.web.********************.js 880 B 0 B
dotcom-rendering/dist/2565.client.web.********************.js 3.77 kB 0 B
dotcom-rendering/dist/2613.client.web.********************.js 530 B 0 B
dotcom-rendering/dist/267.client.web.********************.js 917 B 0 B
dotcom-rendering/dist/27.client.web.********************.js 6.01 kB 0 B
dotcom-rendering/dist/2706.client.web.********************.js 3.06 kB 0 B
dotcom-rendering/dist/281.client.web.********************.js 642 B 0 B
dotcom-rendering/dist/3109.client.web.********************.js 803 B 0 B
dotcom-rendering/dist/3136.client.web.********************.js 3.55 kB 0 B
dotcom-rendering/dist/3215.client.web.********************.js 158 B 0 B
dotcom-rendering/dist/3252.client.web.********************.js 3.84 kB 0 B
dotcom-rendering/dist/3265.client.web.********************.js 44.3 kB 0 B
dotcom-rendering/dist/3270.client.web.********************.js 961 B 0 B
dotcom-rendering/dist/3284.client.web.********************.js 2.42 kB 0 B
dotcom-rendering/dist/3304.client.web.********************.js 853 B 0 B
dotcom-rendering/dist/3386.client.web.********************.js 1.91 kB 0 B
dotcom-rendering/dist/3469.client.web.********************.js 11.2 kB 0 B
dotcom-rendering/dist/3601.client.web.********************.js 3.22 kB 0 B
dotcom-rendering/dist/3641.client.web.********************.js 9.58 kB 0 B
dotcom-rendering/dist/3657.client.web.********************.js 3.22 kB 0 B
dotcom-rendering/dist/366.client.web.********************.js 6.16 kB 0 B
dotcom-rendering/dist/3707.client.web.********************.js 3.87 kB 0 B
dotcom-rendering/dist/3728.client.web.********************.js 4.04 kB 0 B
dotcom-rendering/dist/3746.client.web.********************.js 527 B 0 B
dotcom-rendering/dist/3769.client.web.********************.js 999 B 0 B
dotcom-rendering/dist/3778.client.web.********************.js 8.08 kB 0 B
dotcom-rendering/dist/3992.client.web.********************.js 3.41 kB 0 B
dotcom-rendering/dist/4100.client.web.********************.js 2.86 kB 0 B
dotcom-rendering/dist/4198.client.web.********************.js 1.89 kB 0 B
dotcom-rendering/dist/4228.client.web.********************.js 11.1 kB +55 B (+0.5%)
dotcom-rendering/dist/4258.client.web.********************.js 2.17 kB 0 B
dotcom-rendering/dist/4273.client.web.********************.js 3.02 kB 0 B
dotcom-rendering/dist/4282.client.web.********************.js 685 B 0 B
dotcom-rendering/dist/442.client.web.********************.js 4.27 kB 0 B
dotcom-rendering/dist/4449.client.web.********************.js 2 kB 0 B
dotcom-rendering/dist/4456.client.web.********************.js 5.88 kB 0 B
dotcom-rendering/dist/4501.client.web.********************.js 4.29 kB 0 B
dotcom-rendering/dist/4628.client.web.********************.js 654 B 0 B
dotcom-rendering/dist/4941.client.web.********************.js 890 B 0 B
dotcom-rendering/dist/504.client.web.********************.js 4.9 kB 0 B
dotcom-rendering/dist/5127.client.web.********************.js 618 B 0 B
dotcom-rendering/dist/5129.client.web.********************.js 5.13 kB 0 B
dotcom-rendering/dist/5336.client.web.********************.js 3.29 kB 0 B
dotcom-rendering/dist/5658.client.web.********************.js 750 B 0 B
dotcom-rendering/dist/5677.client.web.********************.js 2.54 kB 0 B
dotcom-rendering/dist/5713.client.web.********************.js 3.87 kB 0 B
dotcom-rendering/dist/5752.client.web.********************.js 4.15 kB 0 B
dotcom-rendering/dist/5757.client.web.********************.js 931 B 0 B
dotcom-rendering/dist/5766.client.web.********************.js 4.49 kB 0 B
dotcom-rendering/dist/5880.client.web.********************.js 828 B 0 B
dotcom-rendering/dist/5941.client.web.********************.js 4.65 kB 0 B
dotcom-rendering/dist/6012.client.web.********************.js 4.41 kB 0 B
dotcom-rendering/dist/6044.client.web.********************.js 726 B 0 B
dotcom-rendering/dist/6071.client.web.********************.js 577 B 0 B
dotcom-rendering/dist/6135.client.web.********************.js 779 B 0 B
dotcom-rendering/dist/6505.client.web.********************.js 1 kB 0 B
dotcom-rendering/dist/6520.client.web.********************.js 6.85 kB 0 B
dotcom-rendering/dist/6554.client.web.********************.js 13 kB 0 B
dotcom-rendering/dist/6598.client.web.********************.js 780 B 0 B
dotcom-rendering/dist/6612.client.web.********************.js 3.21 kB 0 B
dotcom-rendering/dist/6638.client.web.********************.js 907 B 0 B
dotcom-rendering/dist/678.client.web.********************.js 804 B 0 B
dotcom-rendering/dist/7116.client.web.********************.js 23 kB 0 B
dotcom-rendering/dist/7170.client.web.********************.js 3.41 kB 0 B
dotcom-rendering/dist/7304.client.web.********************.js 3.58 kB 0 B
dotcom-rendering/dist/7547.client.web.********************.js 4.41 kB 0 B
dotcom-rendering/dist/7627.client.web.********************.js 20.3 kB 0 B
dotcom-rendering/dist/7691.client.web.********************.js 853 B 0 B
dotcom-rendering/dist/8148.client.web.********************.js 1.91 kB 0 B
dotcom-rendering/dist/83.client.web.********************.js 750 B 0 B
dotcom-rendering/dist/8355.client.web.********************.js 6.04 kB 0 B
dotcom-rendering/dist/8359.client.web.********************.js 3.69 kB 0 B
dotcom-rendering/dist/8429.client.web.********************.js 3.14 kB 0 B
dotcom-rendering/dist/8504.client.web.********************.js 827 B 0 B
dotcom-rendering/dist/8536.client.web.********************.js 595 B 0 B
dotcom-rendering/dist/8626.client.web.********************.js 890 B 0 B
dotcom-rendering/dist/8697.client.web.********************.js 956 B 0 B
dotcom-rendering/dist/8739.client.web.********************.js 7.27 kB 0 B
dotcom-rendering/dist/8768.client.web.********************.js 2.28 kB 0 B
dotcom-rendering/dist/8776.client.web.********************.js 3.64 kB 0 B
dotcom-rendering/dist/8826.client.web.********************.js 4.53 kB 0 B
dotcom-rendering/dist/8833.client.web.********************.js 829 B 0 B
dotcom-rendering/dist/8891.client.web.********************.js 439 B 0 B
dotcom-rendering/dist/8946.client.web.********************.js 5.3 kB 0 B
dotcom-rendering/dist/8975.client.web.********************.js 4.41 kB 0 B
dotcom-rendering/dist/9138.client.web.********************.js 3.79 kB 0 B
dotcom-rendering/dist/9171.client.web.********************.js 10.3 kB 0 B
dotcom-rendering/dist/9184.client.web.********************.js 493 B 0 B
dotcom-rendering/dist/9493.client.web.********************.js 785 B 0 B
dotcom-rendering/dist/9557.client.web.********************.js 921 B 0 B
dotcom-rendering/dist/9631.client.web.********************.js 4.55 kB 0 B
dotcom-rendering/dist/9721.client.web.********************.js 717 B 0 B
dotcom-rendering/dist/9812.client.web.********************.js 3.46 kB 0 B
dotcom-rendering/dist/9835.client.web.********************.js 647 B 0 B
dotcom-rendering/dist/9899.client.web.********************.js 669 B 0 B
dotcom-rendering/dist/Accessibility-importable.client.web.********************.js 6.01 kB 0 B
dotcom-rendering/dist/AdBlockAsk-importable.client.web.********************.js 2.85 kB 0 B
dotcom-rendering/dist/AdPortals-importable.client.web.********************.js 3.7 kB 0 B
dotcom-rendering/dist/AlreadyVisited-importable.client.web.********************.js 425 B 0 B
dotcom-rendering/dist/AppsEpic-importable.client.web.********************.js 3.57 kB 0 B
dotcom-rendering/dist/AppsFooter-importable.client.web.********************.js 3.16 kB 0 B
dotcom-rendering/dist/AppsLightboxImage-importable.client.web.********************.js 3.46 kB 0 B
dotcom-rendering/dist/AppsLightboxImageStore-importable.client.web.********************.js 2.52 kB 0 B
dotcom-rendering/dist/AudioAtomWrapper-importable.client.web.********************.js 3.08 kB 0 B
dotcom-rendering/dist/AudioPlayerWrapper-importable.client.web.********************.js 6.33 kB 0 B
dotcom-rendering/dist/AustralianTerritorySwitcher-importable.client.web.********************.js 4.88 kB 0 B
dotcom-rendering/dist/Branding-importable.client.web.********************.js 2.54 kB 0 B
dotcom-rendering/dist/braze-web-sdk-core.client.web.********************.js 37.2 kB 0 B
dotcom-rendering/dist/BrazeMessaging-importable.client.web.********************.js 1.97 kB 0 B
dotcom-rendering/dist/CalloutBlockComponent-importable.client.web.********************.js 6.71 kB 0 B
dotcom-rendering/dist/CalloutEmbedBlockComponent-importable.client.web.********************.js 8.23 kB 0 B
dotcom-rendering/dist/CardCommentCount-importable.client.web.********************.js 2.98 kB 0 B
dotcom-rendering/dist/Carousel-importable.client.web.********************.js 6.67 kB 0 B
dotcom-rendering/dist/CarouselForNewsletters-importable.client.web.********************.js 4.53 kB 0 B
dotcom-rendering/dist/ChartAtom-importable.client.web.********************.js 540 B 0 B
dotcom-rendering/dist/CommentCount-importable.client.web.********************.js 2.79 kB 0 B
dotcom-rendering/dist/DiscussionApps-importable.client.web.********************.js 1.91 kB 0 B
dotcom-rendering/dist/DiscussionMeta-importable.client.web.********************.js 1.22 kB 0 B
dotcom-rendering/dist/DiscussionWeb-importable.client.web.********************.js 1.74 kB 0 B
dotcom-rendering/dist/DocumentBlockComponent-importable.client.web.********************.js 3.14 kB 0 B
dotcom-rendering/dist/Dropdown-importable.client.web.********************.js 1.72 kB 0 B
dotcom-rendering/dist/EditionSwitcherBanner-importable.client.web.********************.js 5.97 kB 0 B
dotcom-rendering/dist/EmbedBlockComponent-importable.client.web.********************.js 3.75 kB 0 B
dotcom-rendering/dist/EnhancePinnedPost-importable.client.web.********************.js 2.02 kB 0 B
dotcom-rendering/dist/ExpandableMarketingCardWrapper-importable.client.web.********************.js 4.28 kB 0 B
dotcom-rendering/dist/FetchOnwardsData-importable.client.web.********************.js 1.94 kB 0 B
dotcom-rendering/dist/FilterKeyEventsToggle-importable.client.web.********************.js 967 B 0 B
dotcom-rendering/dist/FocusStyles-importable.client.web.********************.js 617 B 0 B
dotcom-rendering/dist/FollowWrapper-importable.client.web.********************.js 3.43 kB 0 B
dotcom-rendering/dist/FooterLabel-importable.client.web.********************.js 347 B 0 B
dotcom-rendering/dist/FooterReaderRevenueLinks-importable.client.web.********************.js 3.71 kB 0 B
dotcom-rendering/dist/frameworks.client.web.********************.js 20.9 kB 0 B
dotcom-rendering/dist/FrontSubNav-importable.client.web.********************.js 7.63 kB 0 B
dotcom-rendering/dist/GetCricketScoreboard-importable.client.web.********************.js 3.82 kB 0 B
dotcom-rendering/dist/GetMatchNav-importable.client.web.********************.js 10.6 kB 0 B
dotcom-rendering/dist/GetMatchStats-importable.client.web.********************.js 7.41 kB 0 B
dotcom-rendering/dist/GetMatchTabs-importable.client.web.********************.js 2.22 kB 0 B
dotcom-rendering/dist/guardian-braze-components-banner.client.web.********************.js 15.8 kB 0 B
dotcom-rendering/dist/guardian-braze-components-end-of-article.client.web.********************.js 10 kB 0 B
dotcom-rendering/dist/GuideAtomWrapper-importable.client.web.********************.js 783 B 0 B
dotcom-rendering/dist/index.client.web.********************.js 46.2 kB -1 B (0%)
dotcom-rendering/dist/InstagramBlockComponent-importable.client.web.********************.js 2.79 kB 0 B
dotcom-rendering/dist/InteractiveAtomMessenger-importable.client.web.********************.js 853 B 0 B
dotcom-rendering/dist/InteractiveBlockComponent-importable.client.web.********************.js 6.56 kB +13 B (+0.2%)
dotcom-rendering/dist/InteractiveContentsBlockComponent-importable.client.web.********************.js 4.25 kB 0 B
dotcom-rendering/dist/KeyEventsCarousel-importable.client.web.********************.js 4.87 kB 0 B
dotcom-rendering/dist/KnowledgeQuizAtom-importable.client.web.********************.js 3.61 kB 0 B
dotcom-rendering/dist/LatestLinks-importable.client.web.********************.js 4.57 kB 0 B
dotcom-rendering/dist/LightboxHash-importable.client.web.********************.js 436 B 0 B
dotcom-rendering/dist/LightboxLayout-importable.client.web.********************.js 6.51 kB 0 B
dotcom-rendering/dist/LiveBlogEpic-importable.client.web.********************.js 3.76 kB 0 B
dotcom-rendering/dist/LiveblogNotifications-importable.client.web.********************.js 5.27 kB 0 B
dotcom-rendering/dist/Liveness-importable.client.web.********************.js 4.83 kB 0 B
dotcom-rendering/dist/ManyNewsletterSignUp-importable.client.web.********************.js 7.63 kB 0 B
dotcom-rendering/dist/MapEmbedBlockComponent-importable.client.web.********************.js 4.97 kB 0 B
dotcom-rendering/dist/Metrics-importable.client.web.********************.js 2.69 kB 0 B
dotcom-rendering/dist/MostViewedFooter-importable.client.web.********************.js 3.84 kB 0 B
dotcom-rendering/dist/MostViewedFooterData-importable.client.web.********************.js 6.08 kB 0 B
dotcom-rendering/dist/MostViewedRightWithAd-importable.client.web.********************.js 5.19 kB 0 B
dotcom-rendering/dist/OnwardsUpper-importable.client.web.********************.js 5.33 kB 0 B
dotcom-rendering/dist/PersonalityQuizAtom-importable.client.web.********************.js 3.76 kB 0 B
dotcom-rendering/dist/ProfileAtom-importable.client.web.********************.js 543 B 0 B
dotcom-rendering/dist/ProfileAtomWrapper-importable.client.web.********************.js 804 B 0 B
dotcom-rendering/dist/PulsingDot-importable.client.web.********************.js 750 B 0 B
dotcom-rendering/dist/QandaAtom-importable.client.web.********************.js 541 B 0 B
dotcom-rendering/dist/ReaderRevenueDev-importable.client.web.********************.js 470 B 0 B
dotcom-rendering/dist/readerRevenueDevUtils.client.web.********************.js 1.96 kB 0 B
dotcom-rendering/dist/RelativeTime-importable.client.web.********************.js 2.53 kB 0 B
dotcom-rendering/dist/RichLinkComponent-importable.client.web.********************.js 6.29 kB 0 B
dotcom-rendering/dist/ScrollableFeature-importable.client.web.********************.js 7.04 kB 0 B
dotcom-rendering/dist/ScrollableHighlights-importable.client.web.********************.js 5.08 kB 0 B
dotcom-rendering/dist/ScrollableMedium-importable.client.web.********************.js 3.73 kB 0 B
dotcom-rendering/dist/ScrollableSmall-importable.client.web.********************.js 3.73 kB 0 B
dotcom-rendering/dist/SecureSignup-importable.client.web.********************.js 4.6 kB 0 B
dotcom-rendering/dist/SendTargetingParams-importable.client.web.********************.js 2.19 kB 0 B
dotcom-rendering/dist/sentry.client.web.********************.js 793 B 0 B
dotcom-rendering/dist/SetABTests-importable.client.web.********************.js 3.86 kB 0 B
dotcom-rendering/dist/SetAdTargeting-importable.client.web.********************.js 482 B 0 B
dotcom-rendering/dist/ShareButton-importable.client.web.********************.js 3.71 kB 0 B
dotcom-rendering/dist/shimport.client.web.********************.js 2.8 kB 0 B
dotcom-rendering/dist/ShowHideContainers-importable.client.web.********************.js 732 B 0 B
dotcom-rendering/dist/ShowMore-importable.client.web.********************.js 1.75 kB 0 B
dotcom-rendering/dist/SignInGateMain.client.web.********************.js 4.51 kB 0 B
dotcom-rendering/dist/SignInGateMainCheckoutComplete.client.web.********************.js 5.61 kB 0 B
dotcom-rendering/dist/SignInGateSelector-importable.client.web.********************.js 3.16 kB 0 B
dotcom-rendering/dist/SlotBodyEnd-importable.client.web.********************.js 3.61 kB 0 B
dotcom-rendering/dist/SpotifyBlockComponent-importable.client.web.********************.js 4.8 kB 0 B
dotcom-rendering/dist/StickyBottomBanner-importable.client.web.********************.js 4.23 kB 0 B
dotcom-rendering/dist/StickyLiveblogAskWrapper-importable.client.web.********************.js 7.67 kB 0 B
dotcom-rendering/dist/SubNav-importable.client.web.********************.js 2.9 kB 0 B
dotcom-rendering/dist/TableOfContents-importable.client.web.********************.js 2.7 kB 0 B
dotcom-rendering/dist/TimelineAtom-importable.client.web.********************.js 1.23 kB 0 B
dotcom-rendering/dist/Titlepiece-importable.client.web.********************.js 14.7 kB 0 B
dotcom-rendering/dist/TopBar-importable.client.web.********************.js 8.24 kB 0 B
dotcom-rendering/dist/TopBarSupport-importable.client.web.********************.js 2.72 kB 0 B
dotcom-rendering/dist/TweetBlockComponent-importable.client.web.********************.js 1.13 kB 0 B
dotcom-rendering/dist/UnsafeEmbedBlockComponent-importable.client.web.********************.js 2.8 kB 0 B
dotcom-rendering/dist/UsEoy2024Wrapper-importable.client.web.********************.js 5.04 kB 0 B
dotcom-rendering/dist/VideoFacebookBlockComponent-importable.client.web.********************.js 4.99 kB 0 B
dotcom-rendering/dist/VineBlockComponent-importable.client.web.********************.js 2.65 kB 0 B
dotcom-rendering/dist/WeatherWrapper-importable.client.web.********************.js 6.55 kB 0 B
dotcom-rendering/dist/YoutubeBlockComponent-importable.client.web.********************.js 6.3 kB 0 B

compressed-size-action

@emdash-ie emdash-ie added the run_chromatic Runs chromatic when label is applied label Nov 12, 2024
@emdash-ie emdash-ie marked this pull request as ready for review November 12, 2024 20:11
@emdash-ie emdash-ie requested a review from a team as a code owner November 12, 2024 20:11
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Nov 12, 2024
@emdash-ie
Copy link
Contributor Author

I’d like to test this on articles with other background colours in dark mode. From the definition of articleBackgroundDark it looks like this is dead blogs, live blogs, and any article when the theme is SpecialReportAlt. I’m not sure yet how to do the last of these – I’ll see if I can figure it out.

@emdash-ie
Copy link
Contributor Author

I’d also like to see it in the apps in dark mode.

@emdash-ie
Copy link
Contributor Author

Another thing has occurred to me that I should test: what happens to Datawrapper graphs that don’t have auto dark mode enabled, in dark mode on this branch? (My worry is that we might get an unreadable graph using light-mode colours on a dark-mode background.)

@emdash-ie
Copy link
Contributor Author

Another thing has occurred to me that I should test: what happens to Datawrapper graphs that don’t have auto dark mode enabled, in dark mode on this branch? (My worry is that we might get an unreadable graph using light-mode colours on a dark-mode background.)

Thankfully, this is not as bad as I had feared: there’s still a white background as there currently is. (Not ideal, but no worse than it currently is.) I’ve added screenshots of this to the PR description.

@emdash-ie
Copy link
Contributor Author

emdash-ie commented Nov 13, 2024

I’d also like to see it in the apps in dark mode.

Since the change should only affect datawrapper graphics for which “auto dark mode” is enabled (and seeing specific articles from capi-CODE in the app seems like a big effort), I’m inclined to merge this before doing this check, and checking datawrapper graphics with “auto dark mode” enabled in the app in PROD (e.g. via the mystery bird article).

@emdash-ie
Copy link
Contributor Author

I’d like to test this on articles with other background colours in dark mode. From the definition of articleBackgroundDark it looks like this is dead blogs, live blogs, and any article when the theme is SpecialReportAlt. I’m not sure yet how to do the last of these – I’ll see if I can figure it out.

I’ve tested live blogs and added screenshots to the PR description. Unfortunately the background colour is wrong and the graphic stands out from its background instead of blending in. Looks like the background is currently #000000 in this situation, but should be #1a1a1a.

In this commit I’ve inlined articleBackgroundDark, and then changed
`sourcePalette.neutral[0]` to `sourcePalette.neutral[10]` to match the
background colour of the individual blocks in live blogs (rather than
the article background).
Copy link
Contributor

@domlander domlander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

I'm not sure what the answer to this is, but it looks like what you've done is sensible.

@domlander domlander added the run_chromatic Runs chromatic when label is applied label Nov 14, 2024
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Nov 14, 2024
@emdash-ie
Copy link
Contributor Author

Looking at dead blogs, they use the same card colour as live blogs (#1a1a1a), but a different background (#121212 for dead instead of #000000 for live). Since these graphics will be on the cards, I should update this to use the same #1a1a1a background for dead blogs as for live.

Dead blogs use the same card colour as live blogs (defined in
liveBlockContainerBackgroundDark). This commit matches the datawrapper
interactive dark mode background colour to this, to avoid clashing
shades of dark grey.
Having these comments will hopefully make it clearer to anyone changing
articleBackgroundDark that this colour needs to change as well.
@emdash-ie
Copy link
Contributor Author

Looking at dead blogs, they use the same card colour as live blogs (#1a1a1a), but a different background (#121212 for dead instead of #000000 for live). Since these graphics will be on the cards, I should update this to use the same #1a1a1a background for dead blogs as for live.

I’ve made this update now in 3a2fffd. I’ll take some screenshots when I get my hands on CODE.

@emdash-ie
Copy link
Contributor Author

Here is what the updated colours look like on live blogs. First with auto dark mode on:

Screenshot 2024-11-14 at 17 01 17

Then with auto dark mode off:

Screenshot 2024-11-14 at 17 04 43

I’ll update these in the table above too, and do new ones for dead blogs.

@emdash-ie
Copy link
Contributor Author

emdash-ie commented Nov 14, 2024

Here are two screenshots showing the new colours on dead blogs:

  • first with automatic dark mode off
Screenshot 2024-11-14 at 17 11 24
  • now with automatic dark mode on
Screenshot 2024-11-14 at 17 12 08

Have also put these in the table in the PR description.

@emdash-ie emdash-ie added the run_chromatic Runs chromatic when label is applied label Nov 14, 2024
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Nov 14, 2024
@emdash-ie
Copy link
Contributor Author

emdash-ie commented Nov 15, 2024

@domlander Would you be ok to accept the pending changes in the UI tests? I’d like to have them accepted before merge if possible, and I don’t have the necessary access.

Unfortunately the Datawrapper embeds are not loading the second time in the snapshots, so we only see the background in the dark mode embed. But these changes do show the background colour changing. It would be nice for the storybook to more accurately reflect the site, so that the background colours match and the different background colours are tested. I’ll take a look and see what I can do.

@emdash-ie
Copy link
Contributor Author

It would be nice for the storybook to more accurately reflect the site, so that the background colours match and the different background colours are tested. I’ll take a look and see what I can do.

Gonna take a look in a separate PR and merge this now, I reckon!

@emdash-ie emdash-ie merged commit 90f72e9 into main Nov 15, 2024
32 checks passed
@emdash-ie emdash-ie deleted the support-datawrapper-auto-dark-mode branch November 15, 2024 12:06
@prout-bot
Copy link

Seen on PROD (merged by @emdash-ie 9 minutes and 51 seconds ago) Please check your changes!

@emdash-ie
Copy link
Contributor Author

emdash-ie commented Nov 15, 2024

Auto dark mode looks good in the apps (testing in PROD with the mystery bird article now that the changes are out):

Datawrapper auto dark mode in app

Though the text could maybe be a bit brighter, it’s a little low-contrast.

@emdash-ie
Copy link
Contributor Author

emdash-ie commented Dec 16, 2024

Auto dark mode looks good in the apps (testing in PROD with the mystery bird article now that the changes are out) […]

Though the text could maybe be a bit brighter, it’s a little low-contrast.

I tested this in Android but not iOS, and it turns out that the font colour in iOS has not been responding to dark mode, resulting in black font disappearing against a black background. I'm looking into how to fix this fully, but in the mean time I'm going to revert this PR.

emdash-ie added a commit that referenced this pull request Dec 16, 2024
…uto-dark-mode"

It turns out the font colour on iOS is not responding correctly to dark
mode graphics, giving us black text on a dark background. While we
figure out how to fix that, we’d like to revert the support for
auto-dark-mode, as adding it slightly reduced the spacing around
light-mode graphics in dark mode.

This reverts commit 90f72e9, reversing
changes made to 89a9121.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants