Dark mode launch screen in iOS 13 - ios

I've updated my iOS app to work in dark mode on iOS 13 but I am having trouble trying to get the launch screen to look good.
Currently it is a bright white screen with the app logo which looks awful in dark mode. I have tried setting the background colour of the launch screen to be a colour asset that I made with "Any Appearance" being white and "Dark Appearance" being black - but the launch screen still always shows as white.
Is there any way to get my launch screen to work properly in dark mode?

When setting up the Launch Screen storyboard, set the view "Background" color to "System Background Color". This will be white in light mode and black in dark mode. No need to use your own color asset.

I found a solution that supports earlier iOS versions as well as custom colors for each mode, dark and light, in iOS 13.
Create an image asset, set Appearances to Any, Light, Dark, and load small solid pngs with your desired colors. In this case I am using orange for light, and black for dark.
Go to your LanuchScreen.storyboard and add an image view with that image asset. Place the image behind your image logo, set Content Mode as Aspect Fill, and constrain the view to the Superview in all sides. (Make sure that your logo looks good with the two backgrounds, or set its Appearance too)
This is where I had to do a trick. For some reason, I couldn't make the back image to show up. After checking some of the comments in Launch Screen storyboard not displaying image, I added the first image in the image asset to the target bundle
The color is static in older versions of iOS, and it works well with dark and light modes in iOS 13.

I was updating my app to support new Dark Mode for iOS 13, I put "System Background Color" for the View's background in my LanuchScreen.storyboard, but surprisingly it didn't work!
The Logo image on the page was changing correctly based on Light/Dark Mode, but not the background!
I was about to apply Jose's solution, but before that, I decided to completely remove the app from my device and try again. And it worked!!

I was missing colors from my color palette in Xcode defaulty offered colors so I created my own using Color.xcassets where I created custom color set with appearences Any, Dark and set my colors.
Then I can use them in autolayout same like System Colors even in LaunchScreen

Yes Launch Screen work in dark mode, First check the background colour of your "xyz" image. if it is ok. just delete you app from device or simulator, because some time Launch Screen cached by device or simulator and you will not get the update UI on it. if you will face same problem just follow my demo app github.com/Indolia/darkmode.git

Related

iOS launch screen for light and dark modes

I follow the instruction in RSP-12931: Native resolution not supported on iPAD Pro to create an iOS LaunchScreen for my Delphi app. Now, with iOS 13, the problem is that I need 2 variants of this launch screen, one for dark mode and another for light mode. How do I create a basic launch screen in XCode that shows a customized background color w/ logo image in dark/light modes?
This is all done inside an Asset Catalog.
For the logo, open your asset catalog and select the image. Now, select the Appearances drop down on the right, and select Any, Light, Dark.
The Asset Catalog will now let you add different images for Any (pre-iOS 13), Light and Dark for that particular image:
For the background color, you'll need to define a custom Color set inside your asset catalog.
Press the + button at the bottom of your list of assets, and select New Color set.
Select the Color set that appears in your assets and, again, adjust the Appearances dropdown to read Any, Light, Dark.
You can now provide different colors for each mode using the RGB sliders underneath the Appearances dropdown:
Now, inside your storyboard you'll be able to select your custom color, and it will adapt depending on the mode running on the device:
You can test this by flipping the Interface Style widget at the bottom of the Interface Builder window between light and dark mode:
After adding images in assets catalog with respect to appearance. If the changes are not reflected, uninstall the application and restart the device.

Any, Dark for colors and Any, Light, Dark for images, why?

I am adapting an existing app to dark mode.
A certain view uses an image to represent the state of a feature. I have selected the image inside the assets catalog and modified its Appearances field from none to Any, Dark. Then I added images for the Dark mode and nope. When I run the app, the image does not appear when the device is on Light mode. That forced me to change that image from Any, Dark to Any, Light, Dark and then define images for the light mode.
I had a label on the same view and I changed that view to Any, Dark just to check and it worked properly.
Why one view works and the other doesn't?
Bug?
Should I change that label to Any, Light, Dark?
You need to put the light image into Any if you only have light and dark.
Any is used in iOS 12 and below where dark mode is not yet available. If you, for instance, had a dark theme before iOS 13, then you would put all your dark assets in Any and Dark and the (new) light assets in Light. This way the app remains dark in iOS <= 12.

How to support Dark mode launch screen in iOS 13 with custom color?

I am working on adapting my existing iOS 11+ app to the new Dark Mode in iOS 13. Using dynamic / named colors works without any problem to switch between been normal and dark appearance, except on the apps launch screen.
A simple XIB file is selected as launch image in the target settings
The launch screen works without any problem, except that the background color is not adapted to normal / dark mode.
The launch screen uses a dynamic / named color as background color. Lets say green is selected for Any appearance and red for "Dark appearance". No matter if the devices is setup to use normal or dark mode the launch screen always shows Any appearance color (green).
If the Any appearance color is set to some other value, e.g. yellow, the launch screen will appear in this color ==> The background color is setup correctly
Toggeling the interface style in Interface Builder shows the correct result ==> The background color is setup correctly
Using the same dynamic color in other places within the app (e.g. on the first view controller) works without any problem ==> The color is setup properly
Using a build in dynamic color like System Background Color works without any problem (white background in normal mode and black background in Dark Mode)
Using dynamic background image instead (as proposed in some other threads) has exactly the same problem (only shows normal appearance color).
So, how to get the launch screen to properly work with Dark mode?

Launch Images for Dark or Light Mode

How can I choose a different set of Launch images for Dark mode and for Light mode?
I have a LaunchImages set. When the application starts, an image is shown. For Light mode it seems good, however if I try to open my application on a device set to Dark mode (iOS 13), this image seems bad.
During the start application I can not use any code for dynamic changes and I have no options in XCode interface for managing it.
As the Launch Screen loads before the app starts executing, it would not be possible to change the launch images set programmatically.
However, in the Image Set tab, you can change the Appearance option to enable a different set of images for Light and Dark modes:
So, if you set this image in the Launch Screen Storyboard, the result would be as below:
On a side note, if the need is just to change the background color, not the images, you may set the Launch Screen Storyboard view background color to System Background Color and just use transparent PNG images.
Xcode 11 supports only storyboard Launch screen files. It means I
should use storyboards.
In storyboards we can use UIImageViews + images from .xcassets.
Assets support images with different variants: Light, Dark modes. You can apply constraints for positioning them on screen.
If you support iOS before 11.0 you can not use system dynamic colors for backgrounds of the screen view. In this case you put additional dynamic image to screen as background and apply leading, trailing, top and bottom constraints with negative values. Negative values are needed for covering Top and Bottom Bars. (I used -64px)
You need to add dark appearance for your asset, or for the asset color you are using, like in the image below:
You should do something like this to use light and dark mode images
Step 1 - Create image set in assets.xassets like this
Step 2 - Select Image select like this
Steps 3 - Change appearance to Any, Light , Dark like this
Add your images for any light and dark mode like this and use this image wherever you need it
Just for my experience, sometimes Launch image is changed when you erase your app, turn off your device and turn on again.

App's icon color is always darker on the iPhone than it is on the iOS simulator or when viewing the image online

I have been trying to solve this app icon color issue all morning. I am still experiencing this after going through both of these highly recommended photoshop/iOS design articles:
http://davidmckinney.com/blog/2013/12/31/designing-iphone-apps-how-to-setup-photoshop
http://bjango.com/articles/photoshop/
Here is the problem that I am having:
When creating my app's icon, the color that I see in Photoshop is the exact same color that I see in xcode's asset catalog. It is also perfect when I run the app on the iOS simulator.
However, when I run my app on my iPhone the app icon's color is always darker.
What's weird, is if I take a screenshot of my iPhone's screen and email it to myself, the color is correct! So for some reason the color is only darker when you are actually looking at the iPhone's screen.
Pardon my ignorance, but this is the first design I have ever done for an iOS app and I don't understand why this is happening or how to fix it.
EDIT: I am now using LiveView after reading this answer: https://stackoverflow.com/a/3597221/3344977
What's funny is no matter how hard I try I cannot get the color I see on my screen to appear on my iPhone screen. It's as if this shade of Pink I'm trying to use just isn't possible to render on an iPhone display.
This is because your iPhone and Monitor screens have different color calibrations (if that's the right term)
You're going to want to setup a color profile on your computer that matches the iPhone screens as closely as possible, and use that when developing icons.
for some reason the color is only darker when you are actually looking at the iPhone's screen
Consider turning up the brightness on your iPhone. Go to Settings->Wallpapers & Brightness to adjust it.
In any case, the issue isn't that the value of the color is changing on your device, it's just that that color value is being rendered differently.
Its because the resolution of your screen is different than your iOS device try it on other device

Resources