android / compose-samples

Official Jetpack Compose samples.
https://developer.android.com/jetpack/compose
Apache License 2.0
19.84k stars 4.71k forks source link

Added a dark theme #1457

Closed IanGClifton closed 2 days ago

IanGClifton commented 1 week ago

Since there are a lot of custom colors used in this app, I created a JetLaggedExtraColors that is handed down as a composition local similar to the main MaterialTheme. I created dark versions of the colors trying to quickly eyeball what looks good, but we can always change them later since they now flow from one place.

This also updates the shaders to accept colors. I used a threshold to make the moving stripes one switch to the background color for the last draw since that was the easiest fix. With more time, adjusting the loop might make it a bit more robust, but I think this works well as a first stab (and we can easily change the colors). The solar flare shader also takes colors now. That one was using alpha to blend, so now it's instead mixing the color channels based on what the alpha would have been.

light theme dark theme

IanGClifton commented 2 days ago

Sounds good to me. I'm happy to file a follow up CL once we get the colors back from design