style: consistent dark browser UI with Safari in asset viewer#26270
style: consistent dark browser UI with Safari in asset viewer#26270mister-ben wants to merge 2 commits intoimmich-app:mainfrom
Conversation
|
Label error. Requires exactly 1 of: changelog:.*. Found: 🖥️web. A maintainer will add the required label. |
danieldietzler
left a comment
There was a problem hiding this comment.
Couple of things I noticed in testing
- This also affects the detail panel; I don't think we want that
- You can toggle the theme with
Shift + T, that will break this - If you toggle the theme on the timeline from light to dark to light, then open an asset, and then go back to the timeline, the UI is still in dark-mode (in parts)
Generally this implementation is like way too complex for what it is though. You can simply add class="dark" to any sub-element (in this case the asset viewer I guess) and it'll work. Check out the button examples https://ui.immich.app/components/button ("always light"/"always dark") if you need an example
|
Unfortunately it is the body rather than the asset viewer component that needs to be black for this to work. Adding This is why the current behaviour is inconsistent. The asset viewer's dark background is only effective for Safari's UI when you start the session with it open, i.e. going directly to https://demo.immich.app/photos/1c27e4ea-29d7-451e-b777-3191930cda3b vs. opening that image from the library. I can't replicate the third of your observations, but all of that could be resolved by using a separate higher specificity selector instead of re-using |
|
Fixed in #26346 |
Description
This is not critical and affects a single browser.
Safari 26 matches the colour of the browser UI (address bar, tabs etc) to the background colour of
body(rather thanmeta name="theme-colour"in earlier versions). When a photo is displayed in the asset manager, which has a black background, it's nice for the browser UI to also be black / dark to give focus to the photo.When the site theme is dark, the browser UI is always black, so all good.
When the site theme is light, the browser UI is usually grey, with an exception. If you go directly to the photo URL, then it's black.
This change makes the UI consistently dark when AssetViewer is rendered.
It adds an action which is used by AssetViewer.
That adds the
darkclass tobodywhen the component mounts. It removes thedarkclass frombodyif the dark theme is not in use. Adding/removing the class causes Safari to update the UI colour.How Has This Been Tested?
Checklist:
[ ] I have made corresponding changes to the documentation if applicableN/A[ ] I have confirmed that any new dependencies are strictly necessary.N/A[ ] All code inN/Asrc/services/uses repositories implementations for database calls, filesystem operations, etc.[ ] All code inN/Asrc/repositories/is pretty basic/simple and does not have any immich specific logic (that belongs insrc/services/)Please describe to which degree, if any, an LLM was used in creating this pull request.
Some research of the codebase looking for what is implemented where. Not LLM-generated code.