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

preferredControlAccentColor does not support dark mode in Asset Catalog colors #16

Open
sebmos opened this issue Mar 17, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@sebmos
Copy link

sebmos commented Mar 17, 2021

Hey,

I'm using the pre-defined AccentColor color in the Asset Catalog of my app, and I've struggled a bit applying it to the SafariView.

I initially tried this, which I'm using in a few places in my app:

.preferredControlAccentColor(.accentColor)

Unfortunately, this resulted iOS' default blue accent color being used. I guess SFSafariViewController lives in its own context that ignores the accent color?

I then tried loading the AccentColor from the Asset Catalog like this:

.preferredControlAccentColor(Color("AccentColor"))

This worked fine in light mode, but failed in dark mode: The light mode color was used in both scenarios.

I finally got it to work by switching back to the deprecated method, setting the UIColor directly:

.preferredControlTintColor(UIColor(named: "AccentColor"))

This works - it appears converting from Color to UIColor loses a lot of information!

I'm not sure if there's a good way to solve this, but it might be worth putting this into the README.md.

@stleamist
Copy link
Owner

Hi Sebastian,

Thank you for reporting this issue! It will be fixed in the next release.

I'll keep you informed when a new version has been released :)

@stleamist stleamist self-assigned this Sep 25, 2021
@stleamist stleamist added the enhancement New feature or request label Sep 25, 2021
@sbilling
Copy link

@stleamist was this ever resolved to your knowledge? I am still running into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants