Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CLKComplication tintColor not working

I am trying to change the colour of text in watch app complication (Modular large tall body), but whatever I do, the text stays white.

Here's my code, of the lines that include tintColor, I've tried them together and each of them one by one.

let secondTemplate = CLKComplicationTemplateModularLargeTallBody()
secondTemplate.tintColor = UIColor.greenColor()
secondTemplate.headerTextProvider.tintColor = UIColor.greenColor()
secondTemplate.bodyTextProvider.tintColor = UIColor.greenColor()
secondTemplate.headerTextProvider = CLKSimpleTextProvider(text: location.uppercaseString)
secondTemplate.bodyTextProvider = CLKSimpleTextProvider(text: "It's 4:20")
let secondEntry = CLKComplicationTimelineEntry(date: dateOf420, complicationTemplate: secondTemplate)
entries.append(secondEntry)

I've looked for questions involving CLKComplication tint color, but I didn't find anything, I hope you can help!

like image 665
user2634633 Avatar asked Oct 11 '15 19:10

user2634633


3 Answers

Unfortunately, the answers here are misleading ... I refused to take "only gray is available" as an answer, so the experimentations began:

enter image description here

Yes, this is my app running with full color and white text for the body. Here is the relevant code:

let headerTextProvider = CLKSimpleTextProvider(text: data.headerText)
headerTextProvider.tintColor = UIColor.yellowColor() // data.headerColor

let textProvider = CLKTimeTextProvider(date: data.date)

let template: CLKComplicationTemplate

switch family {

...

case .ModularLarge:
    let textTemplate = CLKComplicationTemplateModularLargeTallBody()
    textTemplate.headerTextProvider = headerTextProvider
    textTemplate.bodyTextProvider = textProvider
    template = textTemplate

}

template.tintColor = UIColor(red: 0.99, green: 0.99, blue: 0.99, alpha: 1)
return template

Don't ... I have no idea why this even works, but it sure smells like a bug. Could be the colorspace, could be hack, ... we mortals will never now.

like image 72
Mazyod Avatar answered Nov 04 '22 13:11

Mazyod


There are other important changes you should have to know about the tint colors for complications with public watchOS2.

  1. You can't customize tint for Utility Face. Only Modular with Multi Color can be tinted.

  2. You can't customize tints for all elements on complication except elements that are designed to be tinted. For instance, with ModularLargeTallBody or ModularLargeStandardBody You can customize tint for only header text provider. Other tints of elements will ignored and will be shown as gray.

  3. What if you give tintColor to template itself, It will be used as tapping feedback color(It is totally wrong documented by Apple), and it also makes elements that are not tinted in complication to bright white color instead of gray.

It's reasonable behavior IMO, however the Apple's documentation is not reasonable.

like image 39
jeeeyul Avatar answered Nov 04 '22 13:11

jeeeyul


Tint colors in complications are currently only used in two places:

  • Modular face when it’s set to “multicolor”
  • Utility face

Elsewhere, the complication will use the face’s tint color.

like image 31
Noah Witherspoon Avatar answered Nov 04 '22 11:11

Noah Witherspoon