Skip to content
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

[Material3] Which api styles your app icon #2357

Closed
ColtonIdle opened this issue Sep 3, 2021 · 9 comments
Closed

[Material3] Which api styles your app icon #2357

ColtonIdle opened this issue Sep 3, 2021 · 9 comments
Labels

Comments

@ColtonIdle
Copy link

@ColtonIdle ColtonIdle commented Sep 3, 2021

I'm using material3 on my android 12 device and it's working great. The last thing I want to do is allow my app icon to be styled by material you like all of googles apps do on android 12. Is that available somewhere?

@ColtonIdle ColtonIdle added the bug label Sep 3, 2021
@OxygenCobalt
Copy link

@OxygenCobalt OxygenCobalt commented Sep 4, 2021

AFAIK, there is no API. You have the use the system-defined colors manually. This table will probably help.

Loading

@RikkaW
Copy link

@RikkaW RikkaW commented Sep 5, 2021

Loading

@ColtonIdle
Copy link
Author

@ColtonIdle ColtonIdle commented Sep 5, 2021

@RikkaW awesome. Thank you! Do you know if there's a way to have a fallback color (aka my usual colors) if the launcher doesn't support this? The way you have it setup, it looks like the only "check" is whether its api 31

Loading

@RikkaW
Copy link

@RikkaW RikkaW commented Sep 5, 2021

@ColtonIdle There is no launcher that does not support this, since the icon is loaded through framework codes. Also, it's just a color reference, using color reference in drawable is available from very old versions of the Android system.

Loading

@ColtonIdle
Copy link
Author

@ColtonIdle ColtonIdle commented Sep 5, 2021

If I turn off themed icons though... all of googles apps turn back to their original color... but my app icon stays the same material you color, instead of changing to the api 30 and lower colors.

Screen Shot 2021-09-05 at 12 26 11 AM

Loading

@RikkaW
Copy link

@RikkaW RikkaW commented Sep 5, 2021

You have to learn how things work first. Apps can only provide one icon, there is no API for the app to provide a "themed icon". The "Themed icons" from Pixel launcher is its private implementation, the themed icon is provided by Pixel launher itself rather than the app.

Loading

@ColtonIdle
Copy link
Author

@ColtonIdle ColtonIdle commented Sep 5, 2021

I understand that you can only provide a single icon, but I thought that maybe there was a new resource qualifier like values-material3 or something, and if you were using a material3 compatible launcher, then it would choose that instead. The way you stated your answer originally seemed like this was the api to do it where it would use material you colors when available, and use the default colors when it wasn't available.

Loading

@paulkugaev
Copy link

@paulkugaev paulkugaev commented Sep 11, 2021

@ColtonIdle the trick is that google's apps themed icons are embedded into pixel launcher. so there is not API for that and probably won't be

Loading

@drchen
Copy link
Contributor

@drchen drchen commented Sep 16, 2021

Unfortunately there's no plan to have something like values-dynamicColors, at least in Android S.
(It's a framework decision and beyond Material library's control, btw.)

Also I don't think there will be a reliable way (not mentioning a system API) to check if the device is support dynamic colors in S.

On a S device that's not supporting dynamic colors, it will provide a default palette instead, which may differ from brand to brand.

Loading

@drchen drchen closed this Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants