From b9b4a95d39bdae49e4bc02cf4ddcdb457f22dbd8 Mon Sep 17 00:00:00 2001 From: Sodbileg Gansukh Date: Fri, 28 Aug 2026 10:06:08 +0800 Subject: [PATCH] Fixed the Unsplash image selector ignoring dark mode (#30329) ref https://linear.app/ghost/issue/DES-1419/when-picking-an-image-from-unsplash-the-whole-background-is-white-even The Unsplash picker stayed white in dark mode. Two separate implementations sit behind it, and both were broken for different reasons. The React selector (settings, tags, the editor's Unsplash card) had no dark styles at all. Its chrome used `bg-white` and `text-black`, which are fixed values in both Shade and Koenig. It now uses Shade's semantic tokens, which read variables that Shade redefines under `.dark`, so they flip on their own. The Ember picker (tag image, the editor's feature image) was broken by a class-name collision. Spirit's `.bg-white` flips to a dark value, but Shade emits a Tailwind utility of the same name that is hard-coded white. Both have the same specificity and Shade's stylesheet loads later, so Shade won. `gh-unsplash.hbs` was the only template in the Ember admin still using `bg-white`, which is why this was the only place it showed. It now uses its own class that reads the Spirit variable directly. Two supporting changes: - Koenig now scans kg-unsplash-selector and defines the same tokens. The package ships no usable CSS of its own, so whichever host renders it compiles its classes. Admin already scanned it. Koenig only worked because the classes happened to overlap with its own components. - The component sets font sizes explicitly instead of using `text-sm` and friends. Koenig and Shade disagree on every step of that scale, so the same class rendered a different size in the editor than in settings. The rest lines the two pickers up visually: search field padding and font, icon size and colour, author avatar. The buttons on a photo stay light in both themes on purpose, since they sit on the image rather than on the modal. --- .changeset/tidy-mangos-repeat.md | 6 +++ .../app/components/gh-unsplash.hbs | 4 +- .../app/styles/components/unsplash.css | 41 +++++++++++++------ .../src/ui/UnsplashButton.tsx | 2 +- .../src/ui/UnsplashGallery.tsx | 8 ++-- .../src/ui/UnsplashImage.tsx | 2 +- .../src/ui/UnsplashSelector.tsx | 10 ++--- koenig/koenig-lexical/tailwind.config.cjs | 7 +++- 8 files changed, 54 insertions(+), 26 deletions(-) create mode 100644 .changeset/tidy-mangos-repeat.md diff --git a/.changeset/tidy-mangos-repeat.md b/.changeset/tidy-mangos-repeat.md new file mode 100644 index 00000000000..2e7223c7ee0 --- /dev/null +++ b/.changeset/tidy-mangos-repeat.md @@ -0,0 +1,6 @@ +--- +"@tryghost/kg-unsplash-selector": patch +"@tryghost/koenig-lexical": patch +--- + +Fixed the Unsplash selector not following dark mode diff --git a/apps/ember-admin/app/components/gh-unsplash.hbs b/apps/ember-admin/app/components/gh-unsplash.hbs index 36312f9d048..3f353454744 100644 --- a/apps/ember-admin/app/components/gh-unsplash.hbs +++ b/apps/ember-admin/app/components/gh-unsplash.hbs @@ -2,7 +2,7 @@ {{!-- TODO: why does this modal background not cover the PSM without style override? --}}
@@ -82,7 +82,7 @@ {{!-- zoomed image overlay --}} {{#if this.zoomedPhoto}} - + = ({ icon, label, ...props } return ( e.stopPropagation()} {...props} > diff --git a/koenig/kg-unsplash-selector/src/ui/UnsplashGallery.tsx b/koenig/kg-unsplash-selector/src/ui/UnsplashGallery.tsx index eeaa0cd582c..e60c51c2da9 100644 --- a/koenig/kg-unsplash-selector/src/ui/UnsplashGallery.tsx +++ b/koenig/kg-unsplash-selector/src/ui/UnsplashGallery.tsx @@ -34,7 +34,7 @@ const UnsplashGalleryLoading: React.FC = () => { className="absolute inset-y-0 left-0 flex w-full items-center justify-center overflow-hidden pb-[8vh]" data-kg-loader > -
+
); }; @@ -123,9 +123,9 @@ const UnsplashGallery: React.FC = ({ if (error) { return ( -
-

Error

-

{error}

+
+

Error

+

{error}

); diff --git a/koenig/kg-unsplash-selector/src/ui/UnsplashImage.tsx b/koenig/kg-unsplash-selector/src/ui/UnsplashImage.tsx index eff3bf56d3d..1e8c2bef187 100644 --- a/koenig/kg-unsplash-selector/src/ui/UnsplashImage.tsx +++ b/koenig/kg-unsplash-selector/src/ui/UnsplashImage.tsx @@ -75,7 +75,7 @@ const UnsplashImage: FC = ({ className="mr-2 size-8 rounded-full" src={user.profile_image.medium} /> -
+
{user.name}
diff --git a/koenig/kg-unsplash-selector/src/ui/UnsplashSelector.tsx b/koenig/kg-unsplash-selector/src/ui/UnsplashSelector.tsx index 8260e8831b7..275d74a8037 100644 --- a/koenig/kg-unsplash-selector/src/ui/UnsplashSelector.tsx +++ b/koenig/kg-unsplash-selector/src/ui/UnsplashSelector.tsx @@ -18,26 +18,26 @@ const UnsplashSelector: FunctionComponent = ({ <>
-

+

Unsplash

- +