Notes to customize Calibre's Epub Viewer layout and style.
- I don't share a copy of Calibre's configuration folder (it contains more configuration, like menu layouts).
- I'm under Debian/Linux, but thoses notes can be adappted to the other versions.
- Custom color scheme:
"background": "#fffff2",
"foreground": "#1b1b1b",
"link": "#000758",
"margin_bottom": "#fffff2:#484848",
"margin_left": "#fffff2:#484848",
"margin_right": "#fffff2:#484848",
"margin_top": "#fffff2:#484848",
- Stylesheet:
Check the attached style.css file.
style.css is inspired by normalize.css, some advices from MobileRead and my own preferences. It adds some elements like the column separator and it corrects a lot of issues with tables, images and margins.
style.css contains an override to add a dotted separator in a 2 pages layout. But, for a year now, Calibre decided to write the "column-rule" inside the element.style of the body with "!important". To display the separator you have to modify the source code or modify some files installed by the release.
- The issue is in the source code line 302 in src/pyj/read_book/paged_mode.pyj, all is marked as !important.:
set_important_css(document.body, column_gap=gap + 'px', column_width=col_size + 'px', column_rule='0px inset blue',
min_width='0', max_width='none', min_height='0', max_height='100vh', column_fill='auto',
margin='0', border_width='0', padding='0', box_sizing='content-box',
width=scroll_viewport.width() + 'px', height=scroll_viewport.height() + 'px', overflow_wrap='break-word'
)
-
If you build from sources, you can remove
column_rule='0px inset blue',
from the list and adddocument.body.style.columnRule = "0px inset blue";
above it. -
If you installed a release, you can patch the files
/usr/share/calibre/viewer.js
and/usr/share/calibre/content-server/index-generated.html
with the 2 patch files included in the gist:
sudo patch /usr/share/calibre/content-server/index-generated.html < index-generated.html.patch
sudo patch /usr/share/calibre/viewer.js < viewer.js.patch
- Margins
- left/right: 60
- top/bottom: 40
- Page Mode
- Landscape/Portrait: 2
- height/width: 0
- aspect ration: no (I use css dor that)
- Header
- Left: Title
- Middle: Serie
- Right: Author
- Footer
- Left: Parent Section
- Middle: Current Section
- Right: Position
- Default: Serif
- Family: IBM Plex (serif text, sans text, mono text, https://github.com/IBM/plex/releases/latest)
- Zoom steps: 20%
- Minimal font size: 9px
I use Piper with speechdispatcher on linux.
https://github.com/rhasspy/piper
- 18px
Tested column-rule at 150px vs 5px, to see if it affects the layout for this issue.