Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

iOS dark mode placeholder text color problem
Started by ojnab Oct 23 2019 06:54 AM

14 replies to this topic

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

ojnab

[GLOBAL: userInfoPane.html]
ojnab
  • Contributor

  • 587 posts
  • Corona SDK

On native textfields and boxes the color of placeholders are hardcoded in corona core:

[super setText:_placeholder];
[self setTextColor:[UIColor lightGrayColor]];
_showingPlaceholder = true;

In my app I use black text on white backgrounds, so when switching to dark mode the placeholders can't be seen because the text color is the same as the background color. (I do not intend to create a full dark mode version of the app)

 

Please fix it. Thanks.

 



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,300 posts
  • Enterprise

Consider making a pull request with a suggested fix.  I'll ask engineering, but I can't confirm when we can get to it.

 

Rob



[TOPIC: post.html]
#3

ojnab

[GLOBAL: userInfoPane.html]
ojnab
  • Contributor

  • 587 posts
  • Corona SDK

I can do a pull request for iOS with a new textField:setPlaceholderTextColor() call but I suspect you would want this to work on all supported platforms?

 

Would you accept a pull with stubs for the other platforms?



[TOPIC: post.html]
#4

vlads

[GLOBAL: userInfoPane.html]
vlads
  • Contributor

  • 921 posts
  • Corona Staff

I was thinking on fixing the issue tomorrow. Probably I will make that default colors are different when in dark mode.

If it won't work out very well, I'll add setPlaceholderTextColor.



[TOPIC: post.html]
#5

ojnab

[GLOBAL: userInfoPane.html]
ojnab
  • Contributor

  • 587 posts
  • Corona SDK

Great thanks vlads.

 

You might wan't to look into the default text color for the textfields too.

If text color is not set with setTextColor then it uses a system color that are also changed when iOS is in dark mode.

 

This can result in text being "invisible" because it has the same color as the background.


  • vlads likes this

[TOPIC: post.html]
#6

ojnab

[GLOBAL: userInfoPane.html]
ojnab
  • Contributor

  • 587 posts
  • Corona SDK

I just discovered that it is possible to add this to the plist settings in the build.settings:

UIUserInterfaceStyle = "light",

This forces the app to use light mode.

If we rebuild our apps with that everything will work as before.

 

Maybe you should do a blog post warning about this, because dark mode messes with app builds already in the store.



[TOPIC: post.html]
#7

vlads

[GLOBAL: userInfoPane.html]
vlads
  • Contributor

  • 921 posts
  • Corona Staff

I just discovered that it is possible to add this to the plist settings in the build.settings:

UIUserInterfaceStyle = "light",

This forces the app to use light mode.

If we rebuild our apps with that everything will work as before.

 

Maybe you should do a blog post warning about this, because dark mode messes with app builds already in the store.

Thanks. This is great idea!

I also 'fixed' dark mode edit boxes, and added way to detect dark mode. Should be up in next release.



[TOPIC: post.html]
#8

kbradford

[GLOBAL: userInfoPane.html]
kbradford
  • Contributor

  • 249 posts
  • Corona SDK

FYI, iTunes Connect will reject "light" as a key for UIUserInterfaceStyle.  It must be "Light".  Apparently casing matters.


  • ojnab likes this

[TOPIC: post.html]
#9

vlads

[GLOBAL: userInfoPane.html]
vlads
  • Contributor

  • 921 posts
  • Corona Staff

Hey guys. So new build just went up. Please, feel freeto test. It contains both system.getInfo('darkMode') and better defaults for color of text box.

https://developer.coronalabs.com/release/2019/3544/


  • ojnab likes this

[TOPIC: post.html]
#10

Quantumwave

[GLOBAL: userInfoPane.html]
Quantumwave
  • Contributor

  • 110 posts
  • Corona SDK

Please make this work on Mac OS as well.



[TOPIC: post.html]
#11

vlads

[GLOBAL: userInfoPane.html]
vlads
  • Contributor

  • 921 posts
  • Corona Staff

  Best Answer

https://developer.coronalabs.com/release/2019/3545/ should have macOS working as well.



[TOPIC: post.html]
#12

Quantumwave

[GLOBAL: userInfoPane.html]
Quantumwave
  • Contributor

  • 110 posts
  • Corona SDK

It seems the new Dark Mode setting
`UIUserInterfaceStyle = "Light",`
does not work on Mac OS (in macos.plist in build.settings)

[TOPIC: post.html]
#13

vlads

[GLOBAL: userInfoPane.html]
vlads
  • Contributor

  • 921 posts
  • Corona Staff

Oh. Sorry, that is what you mean. Yes, UIUserInterfaceStyle is iOS only. UIKit is unavailable on macOS.
Mac OS entry should be NSRequiresAquaSystemAppearance = true
This will force app to light mode (aka “aqua” on macOS)
  • vlads likes this

[TOPIC: post.html]
#14

Quantumwave

[GLOBAL: userInfoPane.html]
Quantumwave
  • Contributor

  • 110 posts
  • Corona SDK

Thanks vlads!



[TOPIC: post.html]
#15

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,300 posts
  • Enterprise

I've updated the blog post to clarify the plist settings.

 

Rob


  • Quantumwave likes this


[topic_controls]
[/topic_controls]