mirror of
https://github.com/Aminark/legado-ios.git
synced 2026-10-24 04:41:23 +08:00
fix(appearance): 完善深色模式和阅读页面对比度
- 区分按钮填充与图标颜色,统一书架、书源、搜索和阅读设置的选中态 - 调整编辑器语法高亮、键盘工具栏及统计卡片的浅深色显示 - 适配 RSS 正文和登录网页背景,保留书源自定义样式和页面状态 - 补充外观切换、页面对比度和管理页面的回归测试
This commit is contained in:
@@ -34,6 +34,12 @@ public struct RSSReadingPolicy: Sendable {
|
||||
|
||||
public struct RSSHTMLProcessor: Sendable {
|
||||
public static let defaultStyle = "img{max-width:100% !important; width:auto; height:auto;}video{object-fit:fill; max-width:100% !important; width:auto; height:auto;}body{word-wrap:break-word; height:auto;max-width: 100%; width:auto;}"
|
||||
// Keep source CSS later in the cascade so intentional source styling wins.
|
||||
public static let appearanceStyle = """
|
||||
:root{color-scheme:light dark;}
|
||||
body{background-color:#fcfcfc;color:#171717;}
|
||||
@media(prefers-color-scheme:dark){body{background-color:#111113;color:#f2f2f2;}a{color:#9ecbff;}}
|
||||
"""
|
||||
public init() {}
|
||||
|
||||
public func contentHTML(_ content: String, style: String?) -> String {
|
||||
@@ -53,7 +59,7 @@ public struct RSSHTMLProcessor: Sendable {
|
||||
}
|
||||
|
||||
private func injectStyle(into content: String, style: String) -> String {
|
||||
let tag = "<style>\(style)</style>"
|
||||
let tag = "<style>\(Self.appearanceStyle)</style><style>\(style)</style>"
|
||||
if let range = content.range(of: "</style>") {
|
||||
return String(content[..<range.upperBound]) + tag + String(content[range.upperBound...])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user