Skip to content

SwiftUI: Color

With Color, you provide more sense of art in your app. Perhaps some design should be in certain color and not just white and black.

An environment-dependent color.

Apple Documentation

In this tutorial, you’ll learn what more about Color in SwiftUI. You’ll learn:

  • What you can do with Color.


To follow along this tutorial, you’ll need some basic knowledge in:

  • A basic familiarity with Swift.
  • At least Xcode 11

Secondary Color

Apple made a Primary and Secondary color which allows us to quickly use the color for text such as heading and so on. Below is an experiment of stacking secondary color where it adjusts the color itself.

When you turn on dark mode on the simulator, it changes the color. Secondary handles light and dark mode for you.

Color Multiply

One cool thing that you can do with color is by adding them together and it will show you the result of the color addition. Isn’t it cool!


Sometimes you need a color but in a lighter sense, thats where opacity plays an important role here.

Color Literal

If you are the type that likes to see the color, you can always opt for Color Literal. In order to trigger that, you can do the following and select Color Literal.

In which a color will appear and by double clicking it, you will be able to select your own color.

You get the idea of how you are able to do a lot more things with Color in SwiftUI. There are definitely more. Feel free to explore and share what you found.

Where to go From Here

If you feel like you are ready to take on more challenges, feel free to check out some other tutorials that we have created:

Published inSwiftUI

Be First to Comment

Leave a Reply

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

Copyright © DaddyCoding 2020.