- 实现EPUB阅读器搜索功能及选中注释功能 - 优化CFI模块,修复代码审查发现的11个问题 - 实现大书远距目录跳转与后台补全优化方案 - 优化设置面板与章节运行时联动 - 重构及大量改进优化
97 lines
3.5 KiB
Swift
97 lines
3.5 KiB
Swift
import UIKit
|
|
|
|
public struct RDEPUBReaderTheme: Equatable {
|
|
|
|
public var contentBackgroundColor: UIColor
|
|
|
|
public var contentTextColor: UIColor
|
|
|
|
public var toolBackgroundColor: UIColor
|
|
|
|
public var toolControlTextColor: UIColor
|
|
|
|
public var toolControlBorderUnselectColor: UIColor
|
|
|
|
public var toolLineColor: UIColor
|
|
|
|
public init(
|
|
contentBackgroundColor: UIColor,
|
|
contentTextColor: UIColor,
|
|
toolBackgroundColor: UIColor,
|
|
toolControlTextColor: UIColor,
|
|
toolControlBorderUnselectColor: UIColor,
|
|
toolLineColor: UIColor
|
|
) {
|
|
self.contentBackgroundColor = contentBackgroundColor
|
|
self.contentTextColor = contentTextColor
|
|
self.toolBackgroundColor = toolBackgroundColor
|
|
self.toolControlTextColor = toolControlTextColor
|
|
self.toolControlBorderUnselectColor = toolControlBorderUnselectColor
|
|
self.toolLineColor = toolLineColor
|
|
}
|
|
|
|
public static let light = RDEPUBReaderTheme(
|
|
contentBackgroundColor: .white,
|
|
contentTextColor: .black,
|
|
toolBackgroundColor: .white,
|
|
toolControlTextColor: .black,
|
|
toolControlBorderUnselectColor: UIColor.lightGray.withAlphaComponent(0.5),
|
|
toolLineColor: UIColor.lightGray.withAlphaComponent(0.5)
|
|
)
|
|
|
|
public static let dark = RDEPUBReaderTheme(
|
|
contentBackgroundColor: .black,
|
|
contentTextColor: .white,
|
|
toolBackgroundColor: .black,
|
|
toolControlTextColor: .white,
|
|
toolControlBorderUnselectColor: UIColor.lightGray.withAlphaComponent(0.5),
|
|
toolLineColor: UIColor.lightGray.withAlphaComponent(0.5)
|
|
)
|
|
|
|
public static let yellow = RDEPUBReaderTheme(
|
|
contentBackgroundColor: UIColor(red: 0.89, green: 0.87, blue: 0.79, alpha: 1),
|
|
contentTextColor: .black,
|
|
toolBackgroundColor: UIColor(red: 0.89, green: 0.87, blue: 0.79, alpha: 1),
|
|
toolControlTextColor: .black,
|
|
toolControlBorderUnselectColor: UIColor.lightGray.withAlphaComponent(0.5),
|
|
toolLineColor: UIColor.lightGray.withAlphaComponent(0.5)
|
|
)
|
|
|
|
public static let green = RDEPUBReaderTheme(
|
|
contentBackgroundColor: UIColor(red: 0.87, green: 0.91, blue: 0.82, alpha: 1),
|
|
contentTextColor: .black,
|
|
toolBackgroundColor: UIColor(red: 0.87, green: 0.91, blue: 0.82, alpha: 1),
|
|
toolControlTextColor: .black,
|
|
toolControlBorderUnselectColor: UIColor.lightGray.withAlphaComponent(0.5),
|
|
toolLineColor: UIColor.lightGray.withAlphaComponent(0.5)
|
|
)
|
|
|
|
public static let pink = RDEPUBReaderTheme(
|
|
contentBackgroundColor: UIColor(red: 1, green: 0.89, blue: 0.91, alpha: 1),
|
|
contentTextColor: .black,
|
|
toolBackgroundColor: UIColor(red: 1, green: 0.89, blue: 0.91, alpha: 1),
|
|
toolControlTextColor: .black,
|
|
toolControlBorderUnselectColor: UIColor.lightGray.withAlphaComponent(0.5),
|
|
toolLineColor: UIColor.lightGray.withAlphaComponent(0.5)
|
|
)
|
|
|
|
public static let blue = RDEPUBReaderTheme(
|
|
contentBackgroundColor: UIColor(red: 0.8, green: 0.84, blue: 0.89, alpha: 1),
|
|
contentTextColor: .black,
|
|
toolBackgroundColor: UIColor(red: 0.8, green: 0.84, blue: 0.89, alpha: 1),
|
|
toolControlTextColor: .black,
|
|
toolControlBorderUnselectColor: UIColor.lightGray.withAlphaComponent(0.5),
|
|
toolLineColor: UIColor.lightGray.withAlphaComponent(0.5)
|
|
)
|
|
}
|
|
|
|
extension RDEPUBReaderTheme {
|
|
|
|
var themeBackgroundColorCSS: String {
|
|
contentBackgroundColor.ss_cssString
|
|
}
|
|
|
|
var themeTextColorCSS: String {
|
|
contentTextColor.ss_cssString
|
|
}
|
|
} |