如何更改 jekyll 中代码块的背景颜色?
How do I change the background color for code block in jekyll?
我正在玩 Jekyll,并且已经能够更改我网站的背景颜色。然而,无论我在 _syntax-highlighting.scss
中更改哪个背景或背景颜色属性,我仍然得到相同的浅灰色背景(即使我重新启动 jekyll 服务器)。
css/sass 默认文件的 None 对我来说也是显而易见的。
_sass/base.scss
并更改 pre, code
规则:
pre,
code {
...
background-color: #eef;
}
David Jacquel 给出的答案对我不起作用。
以下是对我有用的;
转到此文件 /static/css/main.css
并更改 pre
的参数。
Background
是代码块的背景颜色,color
是其中的字体颜色。
不知何故,.highlight
参数支配 pre
参数。我也注释掉了 .highlight
部分。这就是最终代码的样子。
/* Content */
div.content pre {
background: #d42525;
padding: 10px;
color: rgb(20, 199, 29);
overflow-x: auto;
font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
font-size: 12px;
border: none;
}
/* Removed this part to be able to change background of "pre" */
/* div.content .highlight {
background: #333333;
} */
您可以通过 here
中的参数查看代码块的外观
我正在玩 Jekyll,并且已经能够更改我网站的背景颜色。然而,无论我在 _syntax-highlighting.scss
中更改哪个背景或背景颜色属性,我仍然得到相同的浅灰色背景(即使我重新启动 jekyll 服务器)。
None 对我来说也是显而易见的。
_sass/base.scss
并更改 pre, code
规则:
pre,
code {
...
background-color: #eef;
}
David Jacquel 给出的答案对我不起作用。
以下是对我有用的;
转到此文件 /static/css/main.css
并更改 pre
的参数。
Background
是代码块的背景颜色,color
是其中的字体颜色。
不知何故,.highlight
参数支配 pre
参数。我也注释掉了 .highlight
部分。这就是最终代码的样子。
/* Content */
div.content pre {
background: #d42525;
padding: 10px;
color: rgb(20, 199, 29);
overflow-x: auto;
font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
font-size: 12px;
border: none;
}
/* Removed this part to be able to change background of "pre" */
/* div.content .highlight {
background: #333333;
} */
您可以通过 here
中的参数查看代码块的外观