Skip to content

Add learner-defined custom themes to the EPUB reader#14827

Open
rtibbles wants to merge 3 commits into
learningequality:developfrom
rtibbles:epub-custom-themes-work
Open

Add learner-defined custom themes to the EPUB reader#14827
rtibbles wants to merge 3 commits into
learningequality:developfrom
rtibbles:epub-custom-themes-work

Conversation

@rtibbles

@rtibbles rtibbles commented Jun 9, 2026

Copy link
Copy Markdown
Member

Summary

Brings the EPUB reader's custom themes feature — originally a GSoC contribution — to merge-readiness on the current codebase. Alongside the six fixed themes, learners can create, edit, and delete their own themes (background, text, and link colors), picked via a color picker and persisted per-device in localStorage.

The feature was functional in the GSoC branch; this branch modernises and hardens it.

State Screenshot
Add / edit theme modal modal
Color picker picker
Custom theme applied (My themes list) applied
Dark fixed theme — accessible link color dark

References

Continues the custom-themes work from the GSoC-era epub-custom-themes branch (merge base ~July 2023). No tracking issue was filed for the original work.

Reviewer guidance

How to test: Open any EPUB and open the reader settings (sliders icon). Under Themes, switch the six fixed themes — check link contrast on the dark ones (Black / Grey / Yellow). Under My themes (signed in), add a theme: name it, pick background/text/link colors, save; confirm it applies, appears in the list, and that rename/edit and delete work.

Deliberate convention departure: the six fixed themes are hardcoded hex in EpubConstants.js rather than $themeTokens/$themePalette, so EPUB reading palettes don't shift with Kolibri's app theme. Intentional, but it diverges from the "use theme tokens" guideline and is worth a deliberate decision.

Two maintenance notes:

  • The alwan accessibility patch in ColorPickerModal.vue keys off the library's internal class/attribute names, so an alwan upgrade could silently turn it into a no-op.
  • The focus-restore calls in SettingsSideBar.vue use $refs.<button>.$el.focus(). KButton gained a public focus() method in KDS 5.8.0, which internally just calls this.$el.focus(); we're pinned to 5.7.0, so we focus $el directly for now. Switch these to the public focus() when KDS is upgraded.

AI usage

Used Claude Code throughout. It reviewed the GSoC-derived branch and, under my direction, modernised and hardened it — converting the components from Options (and mixed) API to Composition API, extracting persistence into the useCustomThemes composable, and adding stable theme ids, accessible link colors, CSS-ellipsis names, an alwan accessibility patch, and the test suite — then drove a headless browser to verify rendering and run axe audits on the new UI. I made the design decisions (theme identity, hardcoded vs token colors, auditing color-picker alternatives before keeping alwan) and critically reviewed and revised its output.

@github-actions github-actions Bot added DEV: renderers HTML5 apps, videos, exercises, etc. DEV: frontend SIZE: very large labels Jun 9, 2026
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

@rtibbles rtibbles marked this pull request as ready for review June 11, 2026 15:44
@rtibbles rtibbles added this to the Kolibri 0.20 milestone Jun 11, 2026
@rtibbles rtibbles requested a review from rtibblesbot June 12, 2026 21:53
rtibblesbot

This comment was marked as outdated.

@rtibbles rtibbles force-pushed the epub-custom-themes-work branch from f290d91 to 2e28a08 Compare June 13, 2026 04:36
rtibblesbot

This comment was marked as outdated.

@rtibbles rtibbles requested a review from rtibblesbot June 13, 2026 23:04
Comment thread kolibri/plugins/epub_viewer/frontend/views/ColorPickerModal.vue
Comment thread kolibri/plugins/epub_viewer/frontend/views/SettingsSideBar.vue Outdated
Comment thread kolibri/plugins/epub_viewer/frontend/composables/useCustomThemes.js Outdated
Comment thread kolibri/plugins/epub_viewer/frontend/views/__tests__/CustomThemeItem.spec.js Outdated
@rtibbles rtibbles force-pushed the epub-custom-themes-work branch from 2e28a08 to 614c45e Compare June 14, 2026 05:50
rtibblesbot

This comment was marked as outdated.

@rtibbles rtibbles force-pushed the epub-custom-themes-work branch from 614c45e to eaf7f14 Compare June 14, 2026 06:29
rtibblesbot

This comment was marked as outdated.

@rtibbles rtibbles force-pushed the epub-custom-themes-work branch from eaf7f14 to 5c54c35 Compare June 14, 2026 07:28
rtibblesbot

This comment was marked as outdated.

@rtibbles rtibbles force-pushed the epub-custom-themes-work branch from 5c54c35 to 83ff8ec Compare June 14, 2026 23:16
rtibblesbot

This comment was marked as outdated.

@rtibbles rtibbles requested a review from rtibblesbot June 15, 2026 01:39
rtibblesbot

This comment was marked as outdated.

Add the color picker, add/edit, and delete-confirmation modals that let
learners define custom reader themes, along with shared theme constants
and a helper to derive a hover color from a chosen background. Pulls in
alwan for the color picker.

Co-Authored-By: Richard Tibbles <richard@learningequality.org>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rtibbles rtibbles force-pushed the epub-custom-themes-work branch from 83ff8ec to 38cbd64 Compare June 22, 2026 00:49
rtibblesbot

This comment was marked as outdated.

akila-i and others added 2 commits June 21, 2026 19:08
Render saved custom themes in the settings sidebar with apply, edit, and
delete actions, persist them to local storage, and redesign the fixed
theme picker to match.

Co-Authored-By: Richard Tibbles <richard@learningequality.org>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Use the active theme's link color, falling back to the default link blue,
when styling links in rendered EPUB content.

Co-Authored-By: Richard Tibbles <richard@learningequality.org>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rtibbles rtibbles force-pushed the epub-custom-themes-work branch from 38cbd64 to 9dc6848 Compare June 22, 2026 02:10
rtibblesbot

This comment was marked as outdated.

@rtibbles

This comment was marked as outdated.

@rtibblesbot

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DEV: frontend DEV: renderers HTML5 apps, videos, exercises, etc. SIZE: very large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants