Non-tinted image in complications using WidgetKit

I have a watchOS app where a user can select a picture. I’d like the picture to be displayed in a complication. I’m using WidgetKit, and I found out that for some watch faces (rendering mode = accented), the image gets tinted. Instead of the picture, the user sees only a colored box.

It appears that using the old framework, ClockKit, it was possible to display an image that gets slightly colored with the tint color on tinted watch faces. I believe this is to ensure backward compatibility of old complications.

My question is: can I do the same using WidgetKit? I tried using the widgetAccentable() modifier, but it doesn’t work.

Here's an example of what I mean. In the middle complication, instead of the pink square, I'd like to display the user picture.

We'd need to see the code for this, or we really can't help ypu. You might be doing something obvious that we could help you with, but without any code we're blind.

Here's the code.

I have a basic widget bundle


@main
struct TestWidgetBundle: WidgetBundle {
  var body: some Widget {
    TestCounterWidget()
  }
}

And a simple timeline entry

struct TestEntry: TimelineEntry {
  var date: Date
}

My timeline provider doesn't do much for now either.

struct TestTimelineProvider: TimelineProvider {

  typealias Entry = TestEntry

  func placeholder(in context: Context) -> TestEntry {
    TestEntry(date: .now)
  }

  func getSnapshot(in context: Context, completion: @escaping (TestEntry) -> Void) {
    let entry = TestEntry(date: .now)
    completion(entry)
  }

  func getTimeline(in context: Context, completion: @escaping (Timeline<TestEntry>) -> Void) {
    let calendar = Calendar.current
    let currentDate = Date()
    let entries = [TestEntry(date: .now)]
    let timeline = Timeline(entries: entries, policy: .after(currentDate))
    completion(timeline)
  }
}

and finally the widget

struct TestCounterWidget: Widget {
  let kind: String = "TestCounterWidget"

  var body: some WidgetConfiguration {
    StaticConfiguration(kind: kind, provider: TestTimelineProvider()) { entry in
      if #available(watchOS 10.0, *) {
        TestEntryView(entry: entry)
          .containerBackground(.black, for: .widget)
      } else {
        TestEntryView(entry: entry)
          .padding()
          .background(.black)
      }
    }
    .supportedFamilies([.accessoryRectangular])
    .configurationDisplayName("Title")
    .description("Description")
  }
}

struct TestEntryView: View {
  let entry: TestTimelineProvider.Entry

  var body: some View {
    HStack {
      VStack {
        Group {
          Text("title")
            .font(.system(size: 10, weight: .medium))
            .foregroundStyle(.brandMain)
          Text("subtitle")
            .font(.system(size: 14, weight: .medium))
            .widgetAccentable()
        }
        .frame(maxWidth: .infinity, alignment: .leading)
      }
      Image("placeholder") 
        .aspectRatio(1, contentMode: .fit)
        .clipShape(RoundedRectangle(cornerRadius: 4))
        .widgetAccentable() // commenting this line shows a gray box, instead of a pink one on tinted watch faces.
    }
  }
}

The image placeholder is in the bundle and it's only 5kb. Here's the result:

A tinted watch face vs a non-tinted one.

I'm seeing the same thing in WidgetKit on iOS 18. I wonder if this is a bug in WidgetKit, as I can't imagine this is working as intended. Are you doing this on watchOS 11? What's the behavior on watchOS 10?

I'm using watch OS 10.

Ah, I just figured out how to do this, but it's only on watchOS 11 and iOS 18 unfortunately - .widgetAccentedRenderingMode(.desaturated)

Did the new method work for you? I’m having a similar problem and have been pulling my hair out trying different blend modes.

Non-tinted image in complications using WidgetKit
 
 
Q