Skip to content

Commit

Permalink
Don't tint image (#2461)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitschlag committed Jan 2, 2025
1 parent 19ae52f commit 1c19e95
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions DcWidget/DcWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,13 @@ struct AppShortcutView: View {
Link(destination: app.url) {
if let image = app.image {
Image(uiImage: image)
.resizable()
.frame(width: 56, height: 56)
.cornerRadius(12)
.fullColor()
} else {
Color(.systemBackground)
.frame(width: 56, height: 56)
.cornerRadius(12)
}
}
.frame(width: 56, height: 56)
.cornerRadius(12)
}
}

Expand All @@ -51,15 +49,14 @@ struct ChatShortcutView: View {
if let image = chat.image {
// Use Circle as mask
Image(uiImage: image)
.resizable()
.frame(width: 56, height: 56)
.clipShape(Circle())
.fullColor()
} else {
Color(.systemBackground)
.frame(width: 56, height: 56)
.clipShape(Circle())
}
}
.frame(width: 56, height: 56)
.clipShape(Circle())

}
}

Expand All @@ -77,8 +74,19 @@ struct DcWidget: Widget {
.background()
}
}
.supportedFamilies([.systemSmall, .systemMedium])
.supportedFamilies([.systemSmall, .systemMedium])
.configurationDisplayName(String.localized("ios_widget_apps_title"))
.description(String.localized("ios_widget_apps_description"))
}
}

extension Image {
@ViewBuilder func fullColor() -> some View {
if #available(iOS 18, *) {
self.resizable()
.widgetAccentedRenderingMode(.fullColor)
} else {
self.resizable()
}
}
}

0 comments on commit 1c19e95

Please sign in to comment.