Skip to content

Instantly share code, notes, and snippets.

@dterekhov
Last active October 24, 2025 07:33
Show Gist options
  • Select an option

  • Save dterekhov/00f1918cb753a1d57e3acb78dd236ee1 to your computer and use it in GitHub Desktop.

Select an option

Save dterekhov/00f1918cb753a1d57e3acb78dd236ee1 to your computer and use it in GitHub Desktop.
Hierarchical color styles #tip #swiftui
// Demonstrates hierarchical color variants (primary → quinary).
// Useful for subtle gradients of the same base color without defining new values.
import SwiftUI
struct HierarchicalStylesView: View {
var body: some View {
VStack(spacing: 16) {
Circle().foregroundStyle(Color.red)
Circle().foregroundStyle(Color.red.secondary)
Circle().foregroundStyle(Color.red.tertiary)
Circle().foregroundStyle(Color.red.quaternary)
Circle().foregroundStyle(Color.red.quinary)
}
.frame(maxHeight: .infinity)
.padding()
}
}
#Preview {
HierarchicalStylesView()
}
@dterekhov
Copy link
Copy Markdown
Author

05BE4454-4E03-40AB-A827-0AA8D338C036_1_105_c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment