Skip to content

Commit 36b74e3

Browse files
authored
Fix color or links in dark mode on custom themes (#25391)
1 parent 04fde13 commit 36b74e3

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* [*] Stats: Usability improvements [#25404]
1111
* [*] Reader: Fix an issue with pan gesture failing to dismiss Lightbox [#25372]
1212
* [*] Reader: Fix color of links in comments [#25390]
13+
* [*] Reader: Fix color or links in dark mode on custom themes [#25391]
1314
* [*] Reader: Add support for viewing media galleries fullscreen with a way to swipe between images [#25365]
1415
* [*] Notifications: Fix navigational buttons spacing [#25401]
1516
* [*] [internal] Fix retain cycle in Reader Article screen [#25364]

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)