Add epubjs theme support to the book player
Add a dark theme to the book player via epubjs. The theme itself uses the dark theme of Jellyfin and only changes the colour of the text. For everything but the text, the dark theme from Jellyfin is retained. Should any other theme than the dark theme be chosen by the user, epubjs falls back to it's default theme.
This commit is contained in:
@@ -9,6 +9,7 @@ import Screenfull from 'screenfull';
|
||||
import TableOfContents from './tableOfContents';
|
||||
import dom from '../../scripts/dom';
|
||||
import { translateHtml } from '../../scripts/globalize';
|
||||
import * as userSettings from '../../scripts/settings/userSettings';
|
||||
|
||||
import '../../elements/emby-button/paper-icon-button-light';
|
||||
|
||||
@@ -294,6 +295,12 @@ export class BookPlayer {
|
||||
this.currentSrc = downloadHref;
|
||||
this.rendition = rendition;
|
||||
|
||||
rendition.themes.register('dark', { 'body': { 'color': '#fff' } });
|
||||
|
||||
if (userSettings.theme(undefined) === 'dark' || userSettings.theme(undefined) === null) {
|
||||
rendition.themes.select('dark');
|
||||
}
|
||||
|
||||
return rendition.display().then(() => {
|
||||
const epubElem = document.querySelector('.epub-container');
|
||||
epubElem.style.opacity = '0';
|
||||
|
||||
Reference in New Issue
Block a user