Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[ios] Allow MGLScaleBar to support dark mode on iOS 13 #15524

Merged
merged 1 commit into from
Aug 30, 2019

Conversation

captainbarbosa
Copy link
Contributor

Fixes #15452 by changing the text color before being drawn into the CGContext.

Screenshot 2019-08-29 11 27 44

@friedbunny
Copy link
Contributor

Can you explain what the underlying issue was? Why is self.textColor now contingent on dark mode?

@chloekraw chloekraw added the needs changelog Indicates PR needs a changelog entry prior to merging. label Aug 30, 2019
@friedbunny friedbunny removed the needs changelog Indicates PR needs a changelog entry prior to merging. label Aug 30, 2019
@captainbarbosa
Copy link
Contributor Author

Can you explain what the underlying issue was?

Here's what I think happened - the color of aUITextLabel can't adjust whether or not a device is in dark mode when using a fixed color like [UIColor whiteColor]. So, when switching to dark mode the color remains white, and it then gets drawn into the CGContext, further cementing its permanent color.

Since the inner text color should remain black no matter if the device is in dark mode or not, we don't need to determine if the device is in dark mode at all (as you mentioned in #15524 (review)), since we'll always use a fixed color for now.

In the future, if we do decide to support dark more here more dynamically, perhaps one option is to use [UIColor systemWhite], which appears to handle responses to the current trait environment (and thus dark mode).

@captainbarbosa captainbarbosa merged commit 2984535 into master Aug 30, 2019
@friedbunny friedbunny deleted the ios13-scale-bar branch August 30, 2019 21:54
@friedbunny friedbunny added this to the release-queso milestone Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iOS 13: Scale bar text is illegible in dark mode
3 participants