ColorMango

ColorMango is a Swift Package available for SwiftUI that can help give your Text views pop. The colors of characters or specified substrings will alternate between colors within the user’s set choice.

In its simplest form you enter 2 parameters, the string you want displayed and the color choice:

Mango(text: "Hello world!", colors: .rainbow)

Screen Shot 2022-08-14 at 9 34 10 PM

ColorMango has 6 color choices, 5 preset ones and 1 called .custom() which allows for the user to enter their own array of Color to use:

Mango(text: "Hello world!", colors: .custom([.yellow, .purple]))

Screen Shot 2022-08-14 at 9 39 39 PM

There are also 2 more optional parameters.

You can specify a String to act as the seperator to better clarify which substrings you would like colored:

Mango(text: "Hello world, this is ColorMango", colors: .rasta, separator: " ")

Screen Shot 2022-08-15 at 7 17 32 AM

Lastly, you can specify the colors of the seperators with the same original color choices:

Mango(text: "Hello world, this is ColorMango", colors: .rasta, separator: "o", separatorColors: .custom([.purple]))

Screen Shot 2022-08-15 at 7 25 03 AM

GitHub

View Github