forked from intitni/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStyles.swift
More file actions
55 lines (50 loc) · 1.71 KB
/
Styles.swift
File metadata and controls
55 lines (50 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import AppKit
import SwiftUI
enum Style {
static let panelHeight: Double = 304
static let panelWidth: Double = 454
static let widgetHeight: Double = 30
static var widgetWidth: Double { widgetHeight }
static let widgetPadding: Double = 4
}
extension Color {
static var contentBackground: Color {
Color(nsColor: NSColor(name: nil, dynamicProvider: { appearance in
if appearance.isDarkMode {
return #colorLiteral(red: 0.1580096483, green: 0.1730263829, blue: 0.2026666105, alpha: 1)
}
return .white
}))
}
static var userChatContentBackground: Color {
Color(nsColor: NSColor(name: nil, dynamicProvider: { appearance in
if appearance.isDarkMode {
return #colorLiteral(red: 0.2284317913, green: 0.2145925438, blue: 0.3214019983, alpha: 1)
}
return #colorLiteral(red: 0.896820749, green: 0.8709097223, blue: 0.9766687925, alpha: 1)
}))
}
}
extension NSAppearance {
var isDarkMode: Bool {
if bestMatch(from: [.darkAqua, .aqua]) == .darkAqua {
return true
} else {
return false
}
}
}
extension View {
func xcodeStyleFrame() -> some View {
clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
.overlay(
RoundedRectangle(cornerRadius: 8, style: .continuous)
.stroke(Color.black.opacity(0.3), style: .init(lineWidth: 1))
)
.overlay(
RoundedRectangle(cornerRadius: 7, style: .continuous)
.stroke(Color.white.opacity(0.2), style: .init(lineWidth: 1))
.padding(1)
)
}
}