@@ -9,58 +9,74 @@ import SwiftUI
9
9
10
10
extension Color {
11
11
struct Theme {
12
- /// A soft, paper-like gradient for light mode,
13
- /// and a darker gradient for dark mode.
12
+
13
+ /// Primary background gradient
14
14
static func primaryGradient( isDarkMode: Bool ) -> LinearGradient {
15
15
isDarkMode
16
+ // A near-black gradient with slight variation
16
17
? LinearGradient (
17
- colors: [ Color ( hex: " 2D2438 " ) , Color ( hex: " 1A1B2E " ) ] ,
18
+ colors: [
19
+ Color ( hex: " 111111 " ) ,
20
+ Color ( hex: " 1A1A1A " )
21
+ ] ,
18
22
startPoint: . topLeading,
19
23
endPoint: . bottomTrailing
20
24
)
21
25
: LinearGradient (
22
- // Subtle, near-white tones with a hint of lavender
26
+ // Light/paper-like for normal mode
23
27
colors: [ Color ( hex: " F7F5FC " ) , Color ( hex: " FEFEFF " ) ] ,
24
28
startPoint: . topLeading,
25
29
endPoint: . bottomTrailing
26
30
)
27
31
}
28
32
29
- /// The background for chat bubbles or panels.
30
- /// Light mode is a clean, paper-like white with slight opacity,
31
- /// while dark mode uses a semi-opaque gray.
32
- static func bubbleBackground( isDarkMode: Bool ) -> Color {
33
- isDarkMode
34
- ? Color ( hex: " 2A2A2A " ) . opacity ( 0.7 )
35
- : Color . white. opacity ( 0.9 )
33
+ /// Chat bubble background
34
+ /// For dark mode: user bubbles get a richer purple or dark gray,
35
+ /// assistant bubbles get a simpler dark gray.
36
+ static func bubbleBackground( isDarkMode: Bool , isUser: Bool ) -> Color {
37
+ guard isDarkMode else {
38
+ return Color . white. opacity ( 0.9 ) // paper-like in light mode
39
+ }
40
+ // In dark mode:
41
+ if isUser {
42
+ // A subtle purple-tinted dark color for the user bubble
43
+ return Color ( hex: " 292137 " ) // tweak to preference (hint of purple)
44
+ } else {
45
+ // A neutral dark gray for assistant
46
+ return Color ( hex: " 1E1E1E " )
47
+ }
36
48
}
37
49
38
- /// Primary text color. Lighter gray in dark mode, deep charcoal in light mode.
50
+ /// Primary text color
39
51
static func textPrimary( isDarkMode: Bool ) -> Color {
40
52
isDarkMode
41
- ? Color ( hex: " E1E1E1 " )
42
- : Color ( hex: " 2A2A2A " ) // a soft black for paper-like contrast
53
+ ? Color ( hex: " E5E5E5 " ) // softer white to reduce glare
54
+ : Color ( hex: " 2A2A2A " )
43
55
}
44
56
45
- /// Secondary text color. Dimmer in dark mode, mid-gray in light mode.
57
+ /// Secondary text color
46
58
static func textSecondary( isDarkMode: Bool ) -> Color {
47
59
isDarkMode
48
60
? Color ( hex: " A0A0A0 " )
49
61
: Color ( hex: " 707070 " )
50
62
}
51
63
52
- /// A refined purple gradient for Ophelia’s accent highlights,
53
- /// leaning toward elegance in both modes.
64
+ /// Ophelia’s accent gradient (buttons, highlights, etc.)
54
65
static func accentGradient( isDarkMode: Bool ) -> LinearGradient {
55
66
isDarkMode
56
67
? LinearGradient (
57
- colors: [ Color ( hex: " B389FF " ) , Color ( hex: " 7E3CE2 " ) ] ,
58
- startPoint: . leading,
59
- endPoint: . trailing
68
+ colors: [
69
+ Color ( hex: " 9B6BD1 " ) ,
70
+ Color ( hex: " 6B3EA6 " )
71
+ ] ,
72
+ startPoint: . topLeading,
73
+ endPoint: . bottomTrailing
60
74
)
61
75
: LinearGradient (
62
- // Soft, sophisticated purples for a regal look
63
- colors: [ Color ( hex: " CAB2F2 " ) , Color ( hex: " 8A2BE2 " ) ] ,
76
+ colors: [
77
+ Color ( hex: " CAB2F2 " ) ,
78
+ Color ( hex: " 8A2BE2 " )
79
+ ] ,
64
80
startPoint: . leading,
65
81
endPoint: . trailing
66
82
)
@@ -74,23 +90,22 @@ extension Color {
74
90
Scanner ( string: hexValue) . scanHexInt64 ( & int)
75
91
let a , r , g , b : UInt64
76
92
switch hexValue. count {
77
- case 3 : // RGB (12-bit)
93
+ case 3 :
78
94
( a, r, g, b) = ( 255 , ( int >> 8 ) * 17 ,
79
95
( int >> 4 & 0xF ) * 17 ,
80
96
( int & 0xF ) * 17 )
81
- case 6 : // RGB (24-bit)
97
+ case 6 :
82
98
( a, r, g, b) = ( 255 , int >> 16 ,
83
99
int >> 8 & 0xFF ,
84
100
int & 0xFF )
85
- case 8 : // ARGB (32-bit)
101
+ case 8 :
86
102
( a, r, g, b) = ( ( int >> 24 ) & 0xFF ,
87
103
( int >> 16 ) & 0xFF ,
88
104
( int >> 8 ) & 0xFF ,
89
105
int & 0xFF )
90
106
default :
91
107
( a, r, g, b) = ( 255 , 0 , 0 , 0 )
92
108
}
93
-
94
109
self . init (
95
110
. sRGB,
96
111
red: Double ( r) / 255 ,
0 commit comments