react-native-readium 5.0.0-rc.13 → 5.0.0-rc.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,9 +21,20 @@ import org.readium.r2.navigator.Decoration as ReadiumDecoration
21
21
 
22
22
  // MARK: - Nitro → Readium converters
23
23
 
24
+ // Sepia theme colors — unified across iOS, Android, and web
25
+ private const val SEPIA_BACKGROUND = "#f4ecd8"
26
+ private const val SEPIA_TEXT = "#5f4b32"
27
+
24
28
  internal fun nitroPreferencesToEpub(prefs: Preferences): ReadiumEpubPreferences {
29
+ // When theme is sepia and no explicit colors are set, inject our unified
30
+ // sepia colors so the result matches iOS and web exactly.
31
+ val bgColor = prefs.backgroundColor?.let { parseReadiumColor(it) }
32
+ ?: if (prefs.theme == "sepia" && prefs.backgroundColor == null) parseReadiumColor(SEPIA_BACKGROUND) else null
33
+ val txtColor = prefs.textColor?.let { parseReadiumColor(it) }
34
+ ?: if (prefs.theme == "sepia" && prefs.textColor == null) parseReadiumColor(SEPIA_TEXT) else null
35
+
25
36
  return ReadiumEpubPreferences(
26
- backgroundColor = prefs.backgroundColor?.let { parseReadiumColor(it) },
37
+ backgroundColor = bgColor,
27
38
  columnCount = prefs.columnCount?.let { parseColumnCount(it) },
28
39
  fontFamily = prefs.fontFamily?.let { FontFamily(it) },
29
40
  fontSize = prefs.fontSize,
@@ -42,7 +53,7 @@ internal fun nitroPreferencesToEpub(prefs: Preferences): ReadiumEpubPreferences
42
53
  scroll = prefs.scroll,
43
54
  spread = prefs.spread?.let { parseSpread(it) },
44
55
  textAlign = prefs.textAlign?.let { parseTextAlign(it) },
45
- textColor = prefs.textColor?.let { parseReadiumColor(it) },
56
+ textColor = txtColor,
46
57
  textNormalization = prefs.textNormalization,
47
58
  theme = prefs.theme?.let { parseTheme(it) },
48
59
  typeScale = prefs.typeScale,
@@ -12,9 +12,21 @@ typealias RLink = ReadiumShared.Link
12
12
 
13
13
  // MARK: - Nitro → Readium converters
14
14
 
15
+ // Sepia theme colors — unified across iOS, Android, and web
16
+ private let sepiaBackground = "#f4ecd8"
17
+ private let sepiaText = "#5f4b32"
18
+
15
19
  func nitroPreferencesToEPUB(_ prefs: Preferences) -> EPUBPreferences {
20
+ // When theme is sepia and no explicit colors are set, inject our unified
21
+ // sepia colors so the result matches Android and web exactly.
22
+ let isSepia = prefs.theme == "sepia"
23
+ let bgColor = prefs.backgroundColor.flatMap { ReadiumNavigator.Color(hex: $0) }
24
+ ?? (isSepia && prefs.backgroundColor == nil ? ReadiumNavigator.Color(hex: sepiaBackground) : nil)
25
+ let txtColor = prefs.textColor.flatMap { ReadiumNavigator.Color(hex: $0) }
26
+ ?? (isSepia && prefs.textColor == nil ? ReadiumNavigator.Color(hex: sepiaText) : nil)
27
+
16
28
  return EPUBPreferences(
17
- backgroundColor: prefs.backgroundColor.flatMap { ReadiumNavigator.Color(hex: $0) },
29
+ backgroundColor: bgColor,
18
30
  columnCount: prefs.columnCount.flatMap { ColumnCount(rawValue: $0) },
19
31
  fontFamily: prefs.fontFamily.map { FontFamily(rawValue: $0) },
20
32
  fontSize: prefs.fontSize,
@@ -33,7 +45,7 @@ func nitroPreferencesToEPUB(_ prefs: Preferences) -> EPUBPreferences {
33
45
  scroll: prefs.scroll,
34
46
  spread: prefs.spread.flatMap { Spread(rawValue: $0) },
35
47
  textAlign: prefs.textAlign.flatMap { TextAlignment(rawValue: $0) },
36
- textColor: prefs.textColor.flatMap { ReadiumNavigator.Color(hex: $0) },
48
+ textColor: txtColor,
37
49
  textNormalization: prefs.textNormalization,
38
50
  theme: prefs.theme.flatMap { Theme(rawValue: $0) },
39
51
  typeScale: prefs.typeScale,
@@ -11,8 +11,8 @@ class AssociatedColors {
11
11
 
12
12
  switch theme {
13
13
  case .sepia:
14
- mainColor = UIColor.init(red: 250/255, green: 244/255, blue: 232/255, alpha: 1)
15
- textColor = UIColor.init(red: 18/255, green: 18/255, blue: 18/255, alpha: 1)
14
+ mainColor = UIColor.init(red: 244/255, green: 236/255, blue: 216/255, alpha: 1) // #f4ecd8
15
+ textColor = UIColor.init(red: 95/255, green: 75/255, blue: 50/255, alpha: 1) // #5f4b32
16
16
  case .dark:
17
17
  mainColor = UIColor.black
18
18
  textColor = UIColor.init(red: 254/255, green: 254/255, blue: 254/255, alpha: 1)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-readium",
3
- "version": "5.0.0-rc.13",
3
+ "version": "5.0.0-rc.14",
4
4
  "description": "A react-native wrapper for https://readium.org/",
5
5
  "main": "lib/src/index",
6
6
  "types": "lib/src/index.d.ts",