Skip to content

Instantly share code, notes, and snippets.

@amosgyamfi
Created June 19, 2024 07:07
Show Gist options
  • Save amosgyamfi/06805b55df87a45b462700bf06e9b6d3 to your computer and use it in GitHub Desktop.
Save amosgyamfi/06805b55df87a45b462700bf06e9b6d3 to your computer and use it in GitHub Desktop.
//
// ColorHarmony.swift
// CoreSwiftUI
//
// Created by Amos Gyamfi on 18.6.2024.
//
import SwiftUI
struct ColorHarmony: View {
let burntSienna = #colorLiteral(red: 0.9137254902, green: 0.4549019608, blue: 0.3176470588, alpha: 1)
let burntUmber = #colorLiteral(red: 0.5411764706, green: 0.2, blue: 0.1411764706, alpha: 1)
let cadmiumOrange = #colorLiteral(red: 0.9294117647, green: 0.5294117647, blue: 0.1764705882, alpha: 1)
var body: some View {
ZStack {
Circle()
.trim(from: 0.2, to: 1)
.stroke(style: StrokeStyle(lineWidth: 32, lineCap: .round))
.fill(Color(burntSienna).mix(with: Color(burntUmber), by: 0.5).gradient)
.frame(width: 240, height: 240)
.rotationEffect(.degrees(180))
Circle()
.trim(from: 0.2, to: 0.8)
.stroke(style: StrokeStyle(lineWidth: 32, lineCap: .round))
.fill(Color(burntUmber).mix(with: Color(cadmiumOrange), by: 0.5).gradient)
.frame(width: 170, height: 170)
.rotationEffect(.degrees(180))
Circle()
.trim(from: 0.2, to: 1)
.stroke(style: StrokeStyle(lineWidth: 32, lineCap: .round))
.fill(Color(cadmiumOrange).mix(with: Color(burntSienna), by: 0.5).gradient)
.frame(width: 100, height:100)
.rotationEffect(.degrees(180))
}
}
}
#Preview {
ColorHarmony()
.preferredColorScheme(.dark)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment