mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 13:26:16 +00:00
51 lines
1.2 KiB
Swift
51 lines
1.2 KiB
Swift
//
|
|
// ThemePreview.swift
|
|
// ShhShell
|
|
//
|
|
// Created by neon443 on 27/06/2025.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct ThemePreview: View {
|
|
@State var theme: Theme
|
|
|
|
var body: some View {
|
|
ZStack(alignment: .center) {
|
|
RoundedRectangle(cornerRadius: 10)
|
|
.fill(theme.background.suiColor)
|
|
VStack(alignment: .leading) {
|
|
Text(theme.name)
|
|
.foregroundStyle(theme.foreground.suiColor)
|
|
.font(.headline)
|
|
Spacer()
|
|
HStack(spacing: 8) {
|
|
ForEach(0..<8, id: \.self) { index in
|
|
RoundedRectangle(cornerRadius: 2)
|
|
.frame(width: 16, height: 16)
|
|
.foregroundStyle(theme.ansi[index].suiColor)
|
|
}
|
|
}
|
|
HStack(spacing: 8) {
|
|
ForEach(8..<16, id: \.self) { index in
|
|
RoundedRectangle(cornerRadius: 2)
|
|
.frame(width: 16, height: 16)
|
|
.foregroundStyle(theme.ansi[index].suiColor)
|
|
}
|
|
}
|
|
}
|
|
.padding(8)
|
|
}
|
|
.frame(maxWidth: 200, maxHeight: 90)
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
let url = URL(string: "https://raw.githubusercontent.com/mbadolato/iTerm2-Color-Schemes/master/schemes/catppuccin-frappe.itermcolors")!
|
|
let data = try! Data(contentsOf: url)
|
|
|
|
ThemePreview(
|
|
theme: Theme.decodeTheme(name: "theme", data: data)!
|
|
)
|
|
}
|