-
Notifications
You must be signed in to change notification settings - Fork 11
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
Night/Dark mode support for Android and iOS #25
base: master
Are you sure you want to change the base?
Conversation
07f8012
to
23aa788
Compare
23aa788
to
3715759
Compare
Hello. When I thought about implementing such feature I had a slightly different idea in mind. When using Compose, app's theme is usually not set to dark. Just use CompositionLocal with required palette. I think it would be more practical to solve such a moment at level of generated code: put all images in Res.image.my_image(isDark = true) |
I would like to think that adding the images into the resource directories as originally proposed by @brudaswen is the simpler option here, since it would make use of Androids in built darkmode support and would also work for XML based layouts? When doing that it would be trivial to add your solution too and reference a different image in a theme. Only like proposed by @brudaswen both solutions would work without any additional overhead too. Also the proposed solution would work seamlessly for iOS, which seems like a nice solution tbh. |
bc08658
to
8c9fe3d
Compare
# Conflicts: # gradle-plugin/src/main/java/io/github/skeptick/libres/plugin/LibresImagesGenerationTask.kt
Any news about this MR? 😄 |
We switched to our own version https://github.com/brudaswen/libres/releases/tag/1.2.2-night until there is another solution. The version is available via jitpack https://jitpack.io/#brudaswen/libres/1.2.2-night |
Thank you for publishing your fork as a library. Our team is also in need of this functionality. I wonder why is this PR not approved by library maintainers yet... |
Night/Dark Mode Images
Night/Dark Mode images are supported for Android and iOS by adding the
(night)
modifier. The filename and type ofthe image must match the corresponding day/light version without the
(night)
modifier.drawable-night-nodpi
."appearances" : [ { "appearance" : "luminosity", "value" : "dark" } ]
entry in theimageset
.Closes #24
Output Example
Android
iOS