Skip to content

Commit c9773cc

Browse files
committed
Fix color or links in dark mode on custom themes
1 parent ca6d66d commit c9773cc

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

WordPress/Classes/ViewRelated/Reader/Detail/WebView/ReaderWebView.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ class ReaderWebView: WKWebView {
216216
"""
217217
}
218218

219+
// TODO: remove `reader-full-post.reader-full-post__story-content` from-mobile-reader.css on Calypso when this fixed is shipped on the app level
219220
private func overrideStyles() -> String {
220221
/// Some context: We are fetching the CSS file from a remote endpoint, but we store a local `reader.css` file
221222
/// to override some styles for mobile-specific purposes.
@@ -233,6 +234,13 @@ class ReaderWebView: WKWebView {
233234
font-weight: \(displaySetting.color == .system ? "inherit" : "600");
234235
text-decoration: underline;
235236
}
237+
238+
/* workaround for CMM-1964 */
239+
.reader-full-post.reader-full-post__story-content {
240+
a {
241+
color: var(--main-link-color);
242+
}
243+
}
236244
"""
237245
}
238246

@@ -314,12 +322,12 @@ class ReaderWebView: WKWebView {
314322
}
315323

316324
func linkColor(for trait: UITraitCollection) -> UIColor {
317-
let color = displaySetting.color == .system ? UIAppColor.blue : displaySetting.color.foreground
325+
let color = displaySetting.color == .system ? UIAppColor.link : displaySetting.color.foreground
318326
return color.color(for: trait)
319327
}
320328

321329
func activeLinkColor(for trait: UITraitCollection) -> UIColor {
322-
let color = displaySetting.color == .system ? UIAppColor.blue(.shade30) : displaySetting.color.secondaryForeground
330+
let color = displaySetting.color == .system ? UIAppColor.link : displaySetting.color.secondaryForeground
323331
return color.color(for: trait)
324332
}
325333
}

0 commit comments

Comments
 (0)