Tusky icon indicating copy to clipboard operation
Tusky copied to clipboard

[WIP] [Theming] Add Material You themes

Open nyancrimew opened this issue 2 years ago • 23 comments

This adds support for system (wallpaper based)/user provided themes on SDK 31+, known as Material You in the MD3 spec.

Additionally, to allow for these themes to work and make the app more easily themeable in general some of the color resources usage across the app was refactored to be styleable.

Not fully tested yet, some stuff appears to have broken theming for now, but decided to already open a pull request for this to gauge general interest in this upstream.

Screenshots

Some initial screenshots of different wallpaper based colors and how they affect the light/dark Material You themes, as you can tell from the screenshot with the system volume slider Tusky matches the system when themed like this.

image image image

Something to consider/discuss:

The Material You themes make no use of the blue Tusky brand color, instead fully basing the theme on the provided colors. In my opinion this is how it should be, given that Material You should allow for users to add their own touch to the apps they use and Tusky being a community app for a varied social network, I don't see too much value in trying to preserve a brand identity across customizable themes.

If the brand color turns out to be more important than i currently think we can still add Material You themes, as there are utility methods to align extracted colors to work well with a brand color.

Additionally, if this were wanted and would warrant the even bigger set of changes, I could add backwards compatibility for this feature all the way back to Android 5.0 using an additional external dependency.

Known issues

Things I'm still debugging/working on.

  • [x] Any activity not inheriting from BaseActivity, like SplashActivity, is not correctly themed (this is also an issue for the black theme, so should be addressed anyways)
  • [x] Dialog backgrounds are not properly themed, this too is also an issue with the black theme
  • [x] Trying to send a post crashes the app
  • [ ] There are probably generally still some things left unthemed
  • [ ] Light theme colors need to be properly matched to how the system uses colors in a Material You light theme
  • [ ] There is currently no way for the Material You theme to follow system day/night mode

nyancrimew avatar Jul 15 '22 20:07 nyancrimew

Cool!

I think we specifically changed colorPrimary into more specific colors some time ago tho, I don't remember why, @connyduck might remember

charlag avatar Jul 15 '22 20:07 charlag

I think we specifically changed colorPrimary into more specific colors some time ago tho, I don't remember why, @connyduck might remember

the only use of non colorPrimary i saw in some places where colorPrimary might have been used at some point is tusky_blue, which is the colorPrimary in the non Material You themes, though i might be wrong here.

Obviously open for input, but if we decide to not use Tusky blue in You themes we're gonna have to find some solution for this either way.

nyancrimew avatar Jul 15 '22 20:07 nyancrimew

Added some initial screenshots to the original post

nyancrimew avatar Jul 15 '22 20:07 nyancrimew

hmmm, I think some UI elements should also reflect M3 design, like the FAB new toot button and CW open/close buttons.

but other than that it's looking good!!!

turtlegarden avatar Jul 15 '22 20:07 turtlegarden

@foreverxml this would be a more overall design change, so definitely out of scope for this PR in particular, but if there is broader interest I would be up for working on that in the future.

nyancrimew avatar Jul 15 '22 20:07 nyancrimew

@foreverxml M3 was tried but not adopted yet, there are some issues

charlag avatar Jul 15 '22 20:07 charlag

only worried if this'd be compatible with older versions of android! i know google apps already have a default color scheme for phones that don't have material you compatible but that one's Lame, yet using a different algorithm for colors might lead to inconsistencies

akirapink avatar Jul 15 '22 20:07 akirapink

@nyancrimew @charlag ah, alright! if it causes issues then it's not needed

I was thinking of a thing like Material Files where the appearance of some buttons is altered but the UI structure isn't. meh, either way M3 colors would be a massive improvement and thank you for working on it <3

turtlegarden avatar Jul 15 '22 20:07 turtlegarden

@charlag do you mind elaborating on what the M3 issues were, so that I could take a look?

l3gacyb3ta avatar Jul 15 '22 21:07 l3gacyb3ta

@l3gacyb3ta connyduck tried it out, status bar was huge and not looked nice, he's the last instance for all (esp. design) choices anyway. I would suggest with him first (e.g. in our matrix chat)

charlag avatar Jul 15 '22 21:07 charlag

@TPO100Cofficial

only worried if this'd be compatible with older versions of android! i know google apps already have a default color scheme for phones that don't have material you compatible but that one's Lame, yet using a different algorithm for colors might lead to inconsistencies

As I mentioned if needed I can support this down to Android 5.0 if wanted with consistent color generation, for now the Material You themes simply aren't visible at all below SDK version 31.

nyancrimew avatar Jul 15 '22 21:07 nyancrimew

@charlag @l3gacyb3ta @foreverxml i have some ideas regarding M3, and im probably gonna join the matrix later to discuss that, but I don't think this PR is the right place to discuss M3 in general besides Material You.

nyancrimew avatar Jul 15 '22 21:07 nyancrimew

Touché !

l3gacyb3ta avatar Jul 15 '22 21:07 l3gacyb3ta

This should cover most of the needed changes for basic Material You color support, so I think we can open this up for some more manual/visual testing and initial review!

nyancrimew avatar Jul 16 '22 15:07 nyancrimew

@nyancrimew So what is the state of this? If you address my comment and resolve merge conflicts it should be ready to merge?

@charlag what do you think?

connyduck avatar Aug 05 '22 17:08 connyduck

@connyduck I don't have Android 12 device to test this but I think it's a good change (I wouldn't mind the rest of M3 either tbh)

charlag avatar Aug 05 '22 18:08 charlag

@connyduck I don't have Android 12 device to test this but I think it's a good change (I wouldn't mind the rest of M3 either tbh)

You can easily use ADV """emulator""" which works quite well and let's you use Android 13 and even super old versions if you wish on a computer to my knowledge

Might be obvious but just pointing it out

nonetrix avatar Oct 20 '22 21:10 nonetrix

Why is this editing XML instead of just directly using DynamicColors?

Doomsdayrs avatar Nov 10 '22 19:11 Doomsdayrs

I'm testing this out at the moment - the theming seems somewhat heavy-handed, in that nearly everything is tinted some shade of my Material You theme. If you compare it to e.g. Google Messages, Messages mostly uses a solid light/dark background (I think Material 3 refers to this as Neutral?) with the Material You dynamic colors providing accents and highlights.

nanovad avatar Nov 24 '22 16:11 nanovad

If you compare it to e.g. Google Messages, Messages mostly uses a solid light/dark background (I think Material 3 refers to this as Neutral?) with the Material You dynamic colors providing accents and highlights.

actually that is not true (for me at least). In every app I have (and which uses material you) the background color is "neutral2_900", which is a wallpaper generated color.

Here are some color names which are corresponding to my wallpaper: Screenshot_2023-02-05-01-15-19-038_io.joshking.materialyoucolorviewer.jpg

Might also be that I misunderstood you, so let me know if that happened 😅

SteffoSpieler avatar Feb 05 '23 00:02 SteffoSpieler

Any news on this?

danialbehzadi avatar Sep 12 '23 23:09 danialbehzadi

+1 any updates?

HashJig avatar May 04 '24 15:05 HashJig