Last active
October 23, 2023 20:06
-
-
Save mattyoung/af033cf1a9bd556cf56904f1d4855cc1 to your computer and use it in GitHub Desktop.
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
// | |
// BricsLogo.swift | |
// iOS17-New-Beginning | |
// | |
// Created by Matthew Young on 10/22/23. | |
// | |
import SwiftUI | |
extension ShapeStyle where Self == LinearGradient { | |
static var rainbow: Self { LinearGradient( | |
gradient: .init(colors: repeatElement([Color.red, .orange, .yellow, .green, .blue, .purple, .red, .init(red: 127.0 / 255, green: 0, blue: 1)], count: 2).flatMap { | |
$0 | |
}), | |
startPoint: .leading, | |
endPoint: .trailing | |
) | |
} | |
} | |
struct BricsLogo: View { | |
@ViewBuilder | |
func lettering<S: ShapeStyle>( | |
flag: String, | |
letter: String, | |
alignment: Alignment = .center, | |
style: S = .rainbow | |
) -> some View { | |
// let font = "Verdana Bold" | |
let font = "Baskerville Bold Italic" | |
let fontSize = 120.0 | |
let flagOverSize = fontSize * 1.0 | |
Text(letter) | |
.font(.custom(font, size: fontSize, relativeTo: .largeTitle)) | |
.foregroundStyle(style) | |
.overlay( | |
Text(flag) | |
.font(.custom(font, size: flagOverSize, relativeTo: .largeTitle)) | |
.mask(alignment: alignment, { Text(letter) }) | |
.font(.custom(font, size: fontSize, relativeTo: .largeTitle)) | |
.innerShadow(2) | |
.shadow(2, offset: .init(2, 2)) | |
) | |
} | |
var body: some View { | |
HStack(spacing: -5) { | |
lettering(flag: "๐ง๐ท", letter: "B") | |
lettering(flag: "๐ท๐บ", letter: "R") | |
lettering(flag: "๐ฎ๐ณ", letter: "I") | |
lettering(flag: "๐จ๐ณ", letter: "C") | |
lettering(flag: "๐ฟ๐ฆ", letter: "S") | |
} | |
.padding(.init(50, 30)) | |
.background( | |
UnevenRoundedRectangle( | |
topLeadingRadius: 0, | |
bottomLeadingRadius: 50, | |
bottomTrailingRadius: 50, | |
topTrailingRadius: 50, | |
style: .continuous | |
) | |
.foregroundStyle(.mint.gradient) | |
) | |
} | |
} | |
#Preview { | |
BricsLogo() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment