I think this deserves a repost since not so many ppl have seen it:
TL;DR
⚠️ .foregroundStyle(.primary) and .foregroundStyle(Color.primary) are not the same.
——
With the upcoming depreciation of .foregroundColor() you might go ahead and do a quick search and replace with .foregroundStyle() … ok, and?
In some cases that might give you an unexpected appearance in your UI.
The reason is that .foregroundColor(.primary) is implicitly .foregroundColor(Color.primary), whereas .foregroundStyle(.primary) is implicitly .foregroundStyle(HierarchicalShapeStyle.primary)
So if you want to ensure you keep the black/white appearance of e.g. Text then be explicit and use .foregroundStyle(Color.primary)
The takeaway here is that .foregroundStyle(.primary) is different than .foregroundStyle(Color.primary), so bear that in mind when you make your changes.
The key is that .foregroundStyle(.primary) and .foregroundStyle(Color.primary) give different results