Skip to content

Commit ede4705

Browse files
graycreateclaude
andcommitted
feat: update key views to use adaptive colors for dark mode
Updated UserDetailPage, TagDetailPage, and Webview to use adaptive colors: - Replaced hardcoded .white with Color.primaryText/itemBackground - Replaced .black with Color.primaryText - Replaced .gray with Color.secondaryText - Updated CSS colors in Webview for proper dark mode support - Adjusted overlay opacity for better visibility in both themes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 75280c0 commit ede4705

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

V2er/View/Me/UserDetailPage.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct UserDetailPage: StateView {
4242
}
4343

4444
var foreGroundColor: SwiftUI.Color {
45-
return shouldHideNavbar ? .white.opacity(0.9) : .tintColor
45+
return shouldHideNavbar ? Color.primaryText.opacity(0.9) : .tintColor
4646
}
4747

4848
var body: some View {
@@ -77,7 +77,7 @@ struct UserDetailPage: StateView {
7777
.fade(duration: 0.25)
7878
.resizable()
7979
.blur(radius: 80, opaque: true)
80-
.overlay(Color.black.opacity(withAnimation {shouldHideNavbar ? 0.3 : 0.1}))
80+
.overlay(Color.primaryText.opacity(withAnimation {shouldHideNavbar ? 0.6 : 0.2}))
8181
.frame(maxWidth: .infinity, maxHeight: height)
8282
Spacer().background(.clear)
8383
}
@@ -172,7 +172,7 @@ struct UserDetailPage: StateView {
172172
AvatarView(url: model.avatar, size: heightOfNodeImage)
173173
HStack(alignment: .center,spacing: 4) {
174174
Circle()
175-
.fill(state.model.isOnline ? .green : .gray)
175+
.fill(state.model.isOnline ? .green : Color.secondaryText)
176176
.frame(width: 8, height: 8)
177177
Text(model.userName)
178178
.font(.headline.weight(.semibold))
@@ -203,7 +203,7 @@ struct UserDetailPage: StateView {
203203
.background(Color.lightGray, in: RoundedRectangle(cornerRadius: 10))
204204
.padding(.horizontal, 12)
205205
.padding(.vertical, 10)
206-
.background(.white)
206+
.background(Color.itemBackground)
207207
.clipCorner(12, corners: [.topLeft, .topRight])
208208
}
209209

@@ -298,7 +298,7 @@ struct UserDetailPage: StateView {
298298
NavigationLink(destination: TagDetailPage()) {
299299
Text(data.tag)
300300
.font(.footnote)
301-
.foregroundColor(.black)
301+
.foregroundColor(Color.primaryText)
302302
.lineLimit(1)
303303
.padding(.horizontal, 14)
304304
.padding(.vertical, 8)
@@ -339,14 +339,14 @@ struct UserDetailPage: StateView {
339339
} label: {
340340
Text(title)
341341
.fontWeight(.bold)
342-
.foregroundColor(isSelected ? .white.opacity(0.9) : .tintColor)
342+
.foregroundColor(isSelected ? Color.itemBackground.opacity(0.9) : .tintColor)
343343
.frame(maxWidth: .infinity)
344344
.padding(.vertical, 8)
345345
.background {
346346
VStack {
347347
if isSelected {
348348
RoundedRectangle(cornerRadius: 10)
349-
.fill(.black)
349+
.fill(Color.primaryText)
350350
.matchedGeometryEffect(id: "TAB", in: animation)
351351
}
352352
}

V2er/View/Tag/TagDetailPage.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct TagDetailPage: StateView, InstanceIdentifiable {
4040
}
4141

4242
private var foreGroundColor: Color {
43-
shouldHideNavbar ? .white.opacity(0.9) : .tintColor
43+
shouldHideNavbar ? Color.primaryText.opacity(0.9) : .tintColor
4444
}
4545

4646
private var statusBarStyle: UIStatusBarStyle {
@@ -77,7 +77,7 @@ struct TagDetailPage: StateView, InstanceIdentifiable {
7777
.fade(duration: 0.25)
7878
.resizable()
7979
.blur(radius: 80, opaque: true)
80-
.overlay(Color.black.opacity(withAnimation {shouldHideNavbar ? 0.3 : 0.1}))
80+
.overlay(Color.primaryText.opacity(withAnimation {shouldHideNavbar ? 0.6 : 0.2}))
8181
.frame(height: bannerViewHeight * 1.2 + max(scrollY, 0))
8282
Spacer()
8383
}
@@ -206,7 +206,7 @@ struct TagDetailPage: StateView, InstanceIdentifiable {
206206
}
207207
}
208208
}
209-
.background(.white)
209+
.background(Color.itemBackground)
210210
.clipCorner(12, corners: [.topLeft, .topRight])
211211
}
212212

V2er/View/Widget/RichTextView/Webview.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ struct Webview : UIViewRepresentable {
111111
return """
112112
<style type='text/css'>
113113
img{max-height: 100%; min-height: 100%; height:auto; max-width: 100%; width:auto;margin-bottom:5px; border-radius: \(imageRadius)px;}
114-
h1, h2, h3, h4, h5, h6, p, dl, ol, ul, pre, blockquote {text-align:left|right|center; line-height: \(lineHeight)%; font-family: '\(fontName(fontType: self.fontType))'; color: #000000 \(colorImportant == false ? "" : "!important"); }
114+
h1, h2, h3, h4, h5, h6, p, dl, ol, ul, pre, blockquote {text-align:left|right|center; line-height: \(lineHeight)%; font-family: '\(fontName(fontType: self.fontType))'; color: #1C1C1E \(colorImportant == false ? "" : "!important"); }
115115
iframe{width:100%; height:250px;}
116116
117117
</style>
@@ -121,7 +121,7 @@ struct Webview : UIViewRepresentable {
121121
return """
122122
<style type='text/css'>
123123
img{max-height: 100%; min-height: 100%; height:auto; max-width: 100%; width:auto;margin-bottom:5px; border-radius: \(imageRadius)px;}
124-
h1, h2, h3, h4, h5, h6, p, dl, ol, ul, pre, blockquote {text-align:left|right|center; line-height: \(lineHeight)%; font-family: '\(fontName(fontType: self.fontType))'; color: #F2F2F2 \(colorImportant == false ? "" : "!important"); }
124+
h1, h2, h3, h4, h5, h6, p, dl, ol, ul, pre, blockquote {text-align:left|right|center; line-height: \(lineHeight)%; font-family: '\(fontName(fontType: self.fontType))'; color: #F2F2F7 \(colorImportant == false ? "" : "!important"); }
125125
iframe{width:100%; height:250px;}
126126
127127
</style>
@@ -132,12 +132,12 @@ struct Webview : UIViewRepresentable {
132132
<style type='text/css'>
133133
@media (prefers-color-scheme: light) {
134134
img{max-height: 100%; min-height: 100%; height:auto; max-width: 100%; width:auto;margin-bottom:5px; border-radius: \(imageRadius)px;}
135-
h1, h2, h3, h4, h5, h6, p, dl, ol, ul, pre, blockquote {text-align:left|right|center; line-height: \(lineHeight)%; font-family: '\(fontName(fontType: self.fontType))'; color: #000000 \(colorImportant == false ? "" : "!important"); }
135+
h1, h2, h3, h4, h5, h6, p, dl, ol, ul, pre, blockquote {text-align:left|right|center; line-height: \(lineHeight)%; font-family: '\(fontName(fontType: self.fontType))'; color: #1C1C1E \(colorImportant == false ? "" : "!important"); }
136136
iframe{width:100%; height:250px;}
137137
}
138138
@media (prefers-color-scheme: dark) {
139139
img{max-height: 100%; min-height: 100%; height:auto; max-width: 100%; width:auto;margin-bottom:5px; border-radius: \(imageRadius)px;}
140-
h1, h2, h3, h4, h5, h6, p, dl, ol, ul, pre, blockquote {text-align:left|right|center; line-height: \(lineHeight)%; font-family: '\(fontName(fontType: self.fontType))'; color: #F2F2F2 \(colorImportant == false ? "" : "!important"); }
140+
h1, h2, h3, h4, h5, h6, p, dl, ol, ul, pre, blockquote {text-align:left|right|center; line-height: \(lineHeight)%; font-family: '\(fontName(fontType: self.fontType))'; color: #F2F2F7 \(colorImportant == false ? "" : "!important"); }
141141
iframe{width:100%; height:250px;}
142142
}
143143
</style>

0 commit comments

Comments
 (0)