ReadViewSDK/Sources/RDEpubReaderView/EPUBUI/Settings/RDEPUBReaderTheme.swift
shenlei d7fcda345d refactor: rename RDReaderView -> RDEpubReaderView, update pod config and docs
- Rename source module from RDReaderView to RDEpubReaderView
- Move all source files from Sources/RDReaderView/ to Sources/RDEpubReaderView/
- Update podspec: RDReaderView.podspec -> RDEpubReaderView.podspec
- Update Podfile, demo project, and CocoaPods config for new pod name
- Delete old RDReaderView pod support files from ReadViewDemo/Pods
- Add new RDEpubReaderView pod support files
- Update documentation (API ref, architecture, UML, conventions, etc.)
- Add FixedLayoutRotationTests
- Update .gitignore: exclude .DS_Store, manual unpack backups, _ssoft-output
2026-07-10 19:44:53 +09:00

103 lines
3.8 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 {
/// Background color for the full-screen image viewer.
/// Always near-black regardless of theme, since the image is the focus.
var imageViewerBackgroundColor: UIColor {
UIColor(white: 0.0, alpha: 0.95)
}
var themeBackgroundColorCSS: String {
contentBackgroundColor.rd_cssString
}
var themeTextColorCSS: String {
contentTextColor.rd_cssString
}
}