Can I mix two UIColor together?

后端 未结 6 1566
暖寄归人
暖寄归人 2021-01-12 05:51

I have colorA which is [UIColor blueColor], and colorB, which is [UIColor redColor]. Is this possible for me to render a [UIColor purple]

6条回答
  •  清歌不尽
    2021-01-12 06:43

    Since it is 2020 now, and we have "Dark Mode" available, many "colours" are not just colours anymore, but automatically adapt to color changes. They are created by calling UIColor(dynamicProvider: ...).

    You should check if both colors are dynamic colors, and if they are, return a dynamic color. Mixing one dynamic color and a non-dynamic color doesn't really make sense, so in that case return a non-dynamic color.

提交回复
热议问题