Skip to content

Commit b50e116

Browse files
graycreateclaude
andcommitted
fix: address PR review comments
- Extract hard-coded CSS colors into constants in Webview.swift - Fix text color contrast issue in TabBar badge (use white on red background) - Remove mock data implementation that was auto-reverted 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 6c4465f commit b50e116

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

V2er/View/Widget/RichTextView/Webview.swift

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -105,40 +105,46 @@ struct Webview : UIViewRepresentable {
105105

106106
}
107107

108+
private let lightTextColor = "#1C1C1E"
109+
private let darkTextColor = "#F2F2F7"
110+
108111
func css(colorScheme: colorScheme) -> String {
112+
let imgStyle = "img{max-height: 100%; min-height: 100%; height:auto; max-width: 100%; width:auto;margin-bottom:5px; border-radius: \(imageRadius)px;}"
113+
let iframeStyle = "iframe{width:100%; height:250px;}"
114+
let textStyleBase = "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: "
115+
let importantSuffix = colorImportant == false ? "" : "!important"
116+
109117
switch colorScheme {
110118
case .light:
111119
return """
112120
<style type='text/css'>
113-
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: #1C1C1E \(colorImportant == false ? "" : "!important"); }
115-
iframe{width:100%; height:250px;}
116-
121+
\(imgStyle)
122+
\(textStyleBase)\(lightTextColor) \(importantSuffix); }
123+
\(iframeStyle)
117124
</style>
118125
<BODY>
119126
"""
120-
case .dark :
127+
case .dark:
121128
return """
122129
<style type='text/css'>
123-
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: #F2F2F7 \(colorImportant == false ? "" : "!important"); }
125-
iframe{width:100%; height:250px;}
126-
130+
\(imgStyle)
131+
\(textStyleBase)\(darkTextColor) \(importantSuffix); }
132+
\(iframeStyle)
127133
</style>
128134
<BODY>
129135
"""
130136
case .automatic:
131137
return """
132138
<style type='text/css'>
133139
@media (prefers-color-scheme: light) {
134-
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: #1C1C1E \(colorImportant == false ? "" : "!important"); }
136-
iframe{width:100%; height:250px;}
140+
\(imgStyle)
141+
\(textStyleBase)\(lightTextColor) \(importantSuffix); }
142+
\(iframeStyle)
137143
}
138144
@media (prefers-color-scheme: dark) {
139-
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: #F2F2F7 \(colorImportant == false ? "" : "!important"); }
141-
iframe{width:100%; height:250px;}
145+
\(imgStyle)
146+
\(textStyleBase)\(darkTextColor) \(importantSuffix); }
147+
\(iframeStyle)
142148
}
143149
</style>
144150
<BODY>

V2er/View/Widget/TabBar.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ struct TabBar: View {
7676
VStack {
7777
Text(num.string)
7878
.font(.system(size: 10))
79-
.foregroundColor(Color.itemBackground)
79+
.foregroundColor(.white)
8080
.padding(4)
8181
.background {
8282
Circle()

0 commit comments

Comments
 (0)