如何在 Calibre Ebook Viewer 中获得深色主题/夜间模式?

Daw*_*jee 15 themes calibre

大多数电子书阅读器都带有标准的简易夜间模式开关。我试图在 Calibre 中解决这个问题。到目前为止,我已经能够通过创建应用程序主题来使用我的深色系统主题

$ sudo nano /etc/profile.d/calibre.sh

export CALIBRE_USE_SYSTEM_THEME=1
Run Code Online (Sandbox Code Playgroud)

然后

$ sudo service gdm restart

但我仍然需要帮助使电子书查看器中的背景更暗,文字更亮。

Daw*_*jee 13

除了问题中使整个应用程序主题变暗的步骤之外,还必须在电子书查看器中应用一个主题。以下是如何做到这一点:

保存默认主题

  1. 打开电子书(任何电子书)。
  2. 单击左下角的设置图标(螺丝刀和扳手图标,取决于您的版本)。
  3. 打开主题选项卡并以您选择的名称保存主题。

创建深色主题

  1. 打开用户样式表选项卡
  2. 在此答案的底部粘贴 Solarised Dark 主题 CSS 代码。来自saucemcboss 的Github Repo
  3. 打开主题选项卡并以您选择的名称保存新主题。

这样,它将适用于您所有的电子书,以及应用程序的主题。您可以从主题选项卡的加载按钮在默认主题和深色主题之间切换。

CSS:

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
nav,
section,
summary {
  display: block;
}
audio,
canvas,
video {
  display: inline-block;
}
audio:not([controls]) {
  display: none;
  height: 0;
}
[hidden] {
  display: none;
}
html {
  font-family: sans-serif;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}
body {
  margin: 0;
}
a:focus {
  outline: thin dotted;
}
a:active,
a:hover {
  outline: 0;
}
h1 {
  font-size: 2em;
}
abbr[title] {
  border-bottom: 1px dotted;
}
b,
strong {
  font-weight: bold;
}
dfn {
  font-style: italic;
}
mark {
  background: #ff0;
  color: #000;
}
code,
kbd,
pre,
samp {
  font-family: monospace, serif;
  font-size: 1em;
}
pre {
  white-space: pre-wrap;
  word-wrap: break-word;
}
q {
  quotes: "\201C" "\201D" "\2018" "\2019";
}
small {
  font-size: 80%;
}
sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}
sup {
  top: -0.5em;
}
sub {
  bottom: -0.25em;
}
img {
  border: 0;
}
svg:not(:root) {
  overflow: hidden;
}
figure {
  margin: 0;
}
fieldset {
  border: 1px solid #c0c0c0;
  margin: 0 2px;
  padding: 0.35em 0.625em 0.75em;
}
legend {
  border: 0;
  padding: 0;
}
button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 100%;
  margin: 0;
}
button,
input {
  line-height: normal;
}
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
  -webkit-appearance: button;
  cursor: pointer;
}
button[disabled],
input[disabled] {
  cursor: default;
}
input[type="checkbox"],
input[type="radio"] {
  box-sizing: border-box;
  padding: 0;
}
input[type="search"] {
  -webkit-appearance: textfield;
  -moz-box-sizing: content-box;
  -webkit-box-sizing: content-box;
  box-sizing: content-box;
}
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}
button::-moz-focus-inner,
input::-moz-focus-inner {
  border: 0;
  padding: 0;
}
textarea {
  overflow: auto;
  vertical-align: top;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}
html {
  font-family: 'PT Sans', sans-serif;
}
pre,
code {
  font-family: 'Inconsolata', sans-serif;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'PT Sans Narrow', sans-serif;
  font-weight: 700;
}
html {
  background-color: #073642;
  color: #839496;
}
body {
  background-color: #002b36;
  margin: 0 auto;
  max-width: 23cm;
  border: 1pt solid #586e75;
  padding: 1em;
}
code {
  background-color: #073642;
  padding: 2px;
}
a {
  color: #b58900;
}
a:visited {
  color: #cb4b16;
}
a:hover {
  color: #cb4b16;
}
h1 {
  color: #d33682;
}
h2,
h3,
h4,
h5,
h6 {
  color: #859900;
}
pre {
  background-color: #002b36;
  color: #839496;
  border: 1pt solid #586e75;
  padding: 1em;
  box-shadow: 5pt 5pt 8pt #073642;
}
pre code {
  background-color: #002b36;
}
h1 {
  font-size: 2.8em;
}
h2 {
  font-size: 2.4em;
}
h3 {
  font-size: 1.8em;
}
h4 {
  font-size: 1.4em;
}
h5 {
  font-size: 1.3em;
}
h6 {
  font-size: 1.15em;
}
.tag {
  background-color: #073642;
  color: #d33682;
  padding: 0 0.2em;
}
.todo,
.next,
.done {
  color: #002b36;
  background-color: #dc322f;
  padding: 0 0.2em;
}
.tag {
  -webkit-border-radius: 0.35em;
  -moz-border-radius: 0.35em;
  border-radius: 0.35em;
}
.TODO {
  -webkit-border-radius: 0.2em;
  -moz-border-radius: 0.2em;
  border-radius: 0.2em;
  background-color: #2aa198;
}
.NEXT {
  -webkit-border-radius: 0.2em;
  -moz-border-radius: 0.2em;
  border-radius: 0.2em;
  background-color: #268bd2;
}
.ACTIVE {
  -webkit-border-radius: 0.2em;
  -moz-border-radius: 0.2em;
  border-radius: 0.2em;
  background-color: #268bd2;
}
.DONE {
  -webkit-border-radius: 0.2em;
  -moz-border-radius: 0.2em;
  border-radius: 0.2em;
  background-color: #859900;
}
.WAITING {
  -webkit-border-radius: 0.2em;
  -moz-border-radius: 0.2em;
  border-radius: 0.2em;
  background-color: #cb4b16;
}
.HOLD {
  -webkit-border-radius: 0.2em;
  -moz-border-radius: 0.2em;
  border-radius: 0.2em;
  background-color: #d33682;
}
.NOTE {
  -webkit-border-radius: 0.2em;
  -moz-border-radius: 0.2em;
  border-radius: 0.2em;
  background-color: #d33682;
}
.CANCELLED {
  -webkit-border-radius: 0.2em;
  -moz-border-radius: 0.2em;
  border-radius: 0.2em;
  background-color: #859900;
}
Run Code Online (Sandbox Code Playgroud)


cip*_*cus 6

我认为不需要新的 CSS 文件。此外,主要答案中的说明已过时(与具有不同电子书查看器 GUI 的旧版 Calibre 有关),Calibre 主 GUI 的深色调色板的命令(在问题中)也已过时;在 4.6 版中进行测试,就是export CALIBRE_USE_DARK_PALETTE=1为了达到那个结果——正如@meskobalazs 在评论中所说的那样。)

为了在电子书查看器中获得深色背景和浅色字体,只需用它打开电子书(使用查看器,而不是 Calibre 本身;或者,从 Calibre main 中选择该书并按“查看”(阅读书籍)按钮) ; 然后,右键单击,然后首选项

在此处输入图片说明

然后颜色

在此处输入图片说明

然后新方案

在此处输入图片说明

然后设置背景和前景(文本)的颜色。

选择应用并确定。


对于某些电子书文档,我看到一个奇怪的问题,无论上述设置如何,字体颜色都保持黑色,在这种情况下,不能选择使背景变暗。在这种情况下,其他一些电子书阅读器也有同样的问题(Foliate),而有些可以解决它(Bookworm)。

正如此处关于字体类型所述,电子书中的 CSS 文件可能会覆盖软件设置,包括字体颜色。对此进行测试,我已经提取了 epub 文件(实际上它是一个 zip 文件;有些档案管理器需要zip扩展名,有些可以直接提取)并发现/EXTRACTED_LOCATION/OEBPS/Content/Content.css该行color:Black多次出现的地方。用“灰色”代替它会产生相当暗(但可读)的灰色,而“#DBDBDB”会产生较浅的灰色。(更改后,将提取的文件和文件夹压缩回 zip 文件并将扩展名更改为 epub。)

在这里我发现可以从 Calibre 内部进行更改:转换书籍 > 外观 > 样式,选择转换为相同的格式并选中“颜色”(而不是/在“字体”旁边)。

在此处输入图片说明