Press ESC to close

Swift Dark – Light Theme

Hello friends. In this article, we will talk about how we can change the color of the open and closed themes that come with iOS 13. First of all, it should be mentioned that this feature came with iOS 13. In other words, if you support lower versions, the default color will always appear. Although not in every application, you can easily integrate it into your application.

If you say that my application should not distinguish between open and closed themes, and the user sees the same colors regardless of open or closed, this is also possible. For this, just add a key to your info.plist file. When you set the User Interface Style value to Light, your design will not change even if your phone is in dark mode.

 

If you are going to make 2 different designs for open and closed modes, you have to play with both colors and photos. For this, you need to open the Assets.xcassets file in your project. Then you can add photo or color if you right click on empty place. After the addition process is finished, we need to change the Appearences property of the color or photo to Any, Light, Dark instead of None. Thus, when the user changes the theme, the application will adjust it.

If you have questions, you can reach by e-mail or comment. Good work.

Leave a Reply

Your email address will not be published. Required fields are marked *