Skip to content

Commit 4570008

Browse files
graycreateclaude
andcommitted
feat: improve UI theming consistency across components
- Replace hardcoded colors with semantic color names for better theming - Update text colors to use .primaryText and .secondaryText - Replace Color.bodyText with Color.primaryText throughout - Update Color.tintColor usage for better consistency - Improve MultilineTextField placeholder color theming - Standardize color usage in FeedDetail, UserDetail, UserFeed pages - Enhance RichText component color consistency These changes improve the overall visual consistency and prepare the app for better theme support in the future. 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6fe26ab commit 4570008

File tree

7 files changed

+16
-7
lines changed

7 files changed

+16
-7
lines changed

V2er/View/FeedDetail/FeedDetailPage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable {
134134
} label: {
135135
Image(systemName: "arrow.up.circle.fill")
136136
.font(.title.weight(.regular))
137-
.foregroundColor(Color.bodyText.opacity(hasReplyContent ? 1.0 : 0.6))
137+
.foregroundColor(Color.tintColor.opacity(hasReplyContent ? 1.0 : 0.6))
138138
.padding(.trailing, 6)
139139
.padding(.vertical, 3)
140140
}

V2er/View/FeedDetail/ReplyItemView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ struct ReplyItemView: View {
3030
HStack {
3131
VStack (alignment: .leading, spacing: 4) {
3232
Text(info.userName)
33+
.foregroundColor(.primaryText)
3334
Text(info.time)
3435
.font(.caption2)
36+
.foregroundColor(.secondaryText)
3537
}
3638
Spacer()
3739
// Image(systemName: "heart")

V2er/View/Me/UserDetailPage.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,13 @@ struct UserDetailPage: StateView {
248248
struct ReplyItemView: View {
249249
var data: UserDetailInfo.ReplyInfo.Item
250250
let quoteFont = Style.font(UIFont.prfered(.footnote))
251-
.foregroundColor(Color.bodyText.uiColor)
251+
.foregroundColor(Color.primaryText.uiColor)
252252

253253
var body: some View {
254254
VStack(spacing: 0) {
255255
Text(data.title)
256256
.font(.footnote)
257+
.foregroundColor(.primaryText)
257258
.greedyWidth(.leading)
258259
RichText {
259260
data.content
@@ -272,6 +273,7 @@ struct UserDetailPage: StateView {
272273
.padding(.vertical, 6)
273274
Text(data.time)
274275
.font(.footnote)
276+
.foregroundColor(.secondaryText)
275277
.greedyWidth(.trailing)
276278
}
277279
.padding(12)

V2er/View/Me/UserFeedPage.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ struct UserFeedPage: StateView, InstanceIdentifiable {
5656
HStack(alignment: .top) {
5757
VStack(alignment: .leading, spacing: 5) {
5858
Text(data.userName)
59+
.foregroundColor(.primaryText)
5960
.lineLimit(1)
6061
Text(data.replyUpdate)
6162
.lineLimit(1)
@@ -67,19 +68,21 @@ struct UserFeedPage: StateView, InstanceIdentifiable {
6768
NavigationLink(destination: TagDetailPage()) {
6869
Text(data.tag)
6970
.font(.footnote)
70-
.foregroundColor(.black)
71+
.foregroundColor(.primaryText)
7172
.lineLimit(1)
7273
.padding(.horizontal, 14)
7374
.padding(.vertical, 8)
7475
.background(Color.lightGray)
7576
}
7677
}
7778
Text(data.title)
79+
.foregroundColor(.primaryText)
7880
.greedyWidth(.leading)
7981
.lineLimit(2)
8082
Text("评论\(data.replyNum)")
8183
.lineLimit(1)
8284
.font(.footnote)
85+
.foregroundColor(.secondaryText)
8386
.greedyWidth(.trailing)
8487
}
8588
.padding(12)

V2er/View/Settings/OtherSettingsView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct OtherSettingsView: View {
4545
.foregroundColor(Color.tintColor)
4646
Image(systemName: "chevron.right")
4747
.font(.body.weight(.regular))
48-
.foregroundColor(.gray)
48+
.foregroundColor(.secondaryText)
4949
.padding(.trailing, 16)
5050
}
5151
}

V2er/View/Widget/MultilineTextField.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fileprivate struct UITextViewWrapper: UIViewRepresentable {
2626
textField.isUserInteractionEnabled = true
2727
textField.isScrollEnabled = false
2828
textField.backgroundColor = UIColor.clear
29-
textField.textColor = Color.bodyText.uiColor
29+
textField.textColor = Color.primaryText.uiColor
3030

3131
// textField.textContainer.maximumNumberOfLines = 5
3232

@@ -42,6 +42,8 @@ fileprivate struct UITextViewWrapper: UIViewRepresentable {
4242
if uiView.text != self.text {
4343
uiView.text = self.text
4444
}
45+
// Update text color to ensure it responds to theme changes
46+
uiView.textColor = Color.primaryText.uiColor
4547
if uiView.window != nil, !uiView.isFirstResponder {
4648
// uiView.becomeFirstResponder()
4749
}
@@ -127,7 +129,7 @@ struct MultilineTextField: View {
127129
Group {
128130
if showingPlaceholder {
129131
Text(placeholder)
130-
.foregroundColor(.gray)
132+
.foregroundColor(.secondaryText)
131133
.padding(.leading, 4)
132134
}
133135
}

V2er/View/Widget/RichText/RichText.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ struct RichText: View {
3838

3939
struct Styles {
4040
public static let base = Style.font(UIFont.prfered(.body))
41-
.foregroundColor(Color.bodyText.uiColor)
41+
.foregroundColor(Color.primaryText.uiColor)
4242
public static let link = Style("a")
4343
.font(.boldSystemFont(ofSize: 16))
4444
.foregroundColor(Color.url.uiColor, .normal)

0 commit comments

Comments
 (0)