1
0
mirror of https://github.com/janeczku/calibre-web synced 2025-10-27 13:28:04 +00:00

Updating theme logic and persisting theme change

This commit is contained in:
Purbayan Chowdhury
2024-01-08 16:56:13 +05:30
parent 902fa254b0
commit 05032aed3c
2 changed files with 130 additions and 108 deletions

View File

@@ -13,10 +13,9 @@ var reader;
bookmarks: calibre.bookmark ? [calibre.bookmark] : []
});
reader.rendition.themes.register("lightTheme", "/static/css/epub_themes.css");
reader.rendition.themes.register("darkTheme", "/static/css/epub_themes.css");
reader.rendition.themes.register("sepiaTheme", "/static/css/epub_themes.css");
reader.rendition.themes.register("blackTheme", "/static/css/epub_themes.css");
Object.keys(themes).forEach(function (theme) {
reader.rendition.themes.register(theme, themes[theme].css_path);
});
if (calibre.useBookmarks) {
reader.on("reader:bookmarked", updateBookmark.bind(reader, "add"));
@@ -78,6 +77,10 @@ var reader;
alert(error);
});
}
// Default settings load
const theme = localStorage.getItem("calibre.reader.theme") ?? Object.keys(themes)[0];
selectTheme(theme);
})();