Last active
October 24, 2025 07:33
-
-
Save dterekhov/00f1918cb753a1d57e3acb78dd236ee1 to your computer and use it in GitHub Desktop.
Hierarchical color styles #tip #swiftui
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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() | |
| } |
Author
dterekhov
commented
Oct 17, 2025

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