✨ feat(reader): add a Dark sepia theme (#91) - #92
Merged
Conversation
Light, Dark and Sepia all assume you want either a bright page or a cold high-contrast one. On a phone in a dark room none of them are comfortable, and the workaround reported in #91 — pick Sepia, then turn on Android's system-wide colour inversion — inverts images and covers along with the text. Dark sepia is warm text on a warm-dark background: Calibre's own "sepia dark" values (#F6F3E9 on #39322B), since that is the scheme the request named. The pair is 11.36:1, softer than Dark's ~19.6:1 but well past the WCAG AAA floor; a test asserts it stays above AA so a later colour tweak can't quietly make the theme unreadable. It is built on Readium's DARK appearance rather than SEPIA: the sepia stylesheet blends images with mix-blend-mode: multiply, which assumes a light backdrop and smears them against a dark one. The custom colours ride on top via EpubPreferences.textColor/backgroundColor, which ReadiumCSS applies unconditionally — unlike line height and paragraph indent, they are not gated behind the publisher-styles toggle, so the theme holds either way. Two call sites needed care: - The immersive system bars keyed off `theme != DARK`, which would have painted dark icons onto the new dark background. That is now `!theme.isDark`, a property of the theme rather than an equality test. - Both theme pickers formatted labels with `name.lowercase()`, which renders DARK_SEPIA as "Dark_sepia", and laid four options out in a non-wrapping Row. They now share a displayLabel() helper and stack vertically, matching the font-family picker directly below them. The enum deliberately holds no Readium type: Readium's Theme initialises through android.graphics.Color, so storing one would drag the framework into the class initializer and force every plain JVM test that names a theme onto Robolectric. Verified on an emulator (Pixel 10, API 37): the rendered page samples exactly #39322B / #F6F3E9. Links stay cyan, as they already do in Dark — night mode forces that colour at higher specificity.
This was referenced Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #91.
The problem
Quire ships three reader themes, and on a phone in a dark room none of them work. Light and Sepia are both bright pages; Dark is cold white-on-black at roughly 19.6:1 contrast. The reporter's workaround was to select Sepia and switch on Android's system-wide colour inversion — which also inverts every image and cover in the book.
What this adds
A fourth preset, Dark sepia: warm text on a warm-dark background, using Calibre's own
sepia-darkvalues (#F6F3E9on#39322B) since that is the scheme the request named. The pair measures 11.36:1 — softer than Dark, still past the WCAG AAA floor. A test asserts it stays above the AA floor of 4.5:1, so a later colour tweak can't quietly make the theme unreadable.Custom colours were only worth attempting once one thing was settled: whether Readium gates them the same way it gates line height and paragraph indent. If it did, the theme would silently do nothing for anyone who leaves "use the book's paragraph styling" switched on. It doesn't —
--USER__textColorand--USER__backgroundColorcarry noreadium-advanced-onprefix in ReadiumCSS, and the Kotlin side assigns them unconditionally. The same rules are present in the RTL and CJK stylesheets, so right-to-left and vertical-script books get the theme too.The preset is built on Readium's DARK appearance rather than SEPIA. Sepia would be the intuitive base, but its stylesheet blends images with
mix-blend-mode: multiply, which assumes a light backdrop and smears them against a dark one.Two things that needed care
theme != DARK. A new dark theme that isn't literallyDARKwould have got dark icons on a dark background — invisible buttons. That's now!theme.isDark, a property of the theme rather than an equality check.name.lowercase(), which rendersDARK_SEPIAas "Dark_sepia", and laid the options out in a non-wrappingRowthat a fourth entry would overflow on a narrow screen. They now share adisplayLabel()helper and stack vertically, matching the font-family picker directly below them in both files.The enum deliberately holds no Readium type. An earlier revision put
Themein the constructor; because Readium'sThemeinitialises throughandroid.graphics.Color, that dragged the Android framework into the class initializer and broke every plain JVM test that so much as named a theme. The mapping lives in an exhaustivewheninstead, which still fails compilation if a future theme forgets to declare its appearance.What does not change
The three existing themes emit
nullfor both colours, so their rendering is byte-identical to before — there's a regression test pinning exactly that. Persistence needed no change: themes are stored by enum name with a fallback to Light, so a downgrade to an older build resets to Light rather than crashing. Nothing outside the reader surface is re-themed; the app's own chrome is untouched.Links still render cyan rather than warm — night mode forces that colour at higher specificity than the user text colour. That is already true of Dark today, so it's left alone.
Verification
Built and installed on an emulator (Pixel 10, API 37) and read a real EPUB through it. Sampling the rendered page gives exactly
#39322Bbackground and#F6F3E9text, which confirms the preference survives the whole path into ReadiumCSS. The picker renders "Dark sepia" with no underscore and all four options fit.CONTRIBUTING asks for before/after screenshots on UI changes; they were captured locally during that emulator run but aren't attachable from the CLI, so the pixel sampling above stands in as the evidence.
One unrelated thing surfaced on the emulator: the app trips Android's 16 KB page-size warning via two dependency native libs (
libimage_processing_util_jni.so,libandroidx.graphics.path.so). It runs in compatibility mode. Pre-existing and out of scope here, but worth its own issue.