自定义 emacs 降价模式的外观
Customize appearance of emacs markdown-mode
我想更改 emacs markdown-mode 的背景颜色,但只更改代码部分,主要是因为我希望它们很容易与其他部分区分开来。我浏览了一些颜色主题,但似乎找不到合适的变量来执行此操作。
我在 'Andreas' 主题上使用略有修改的版本的 colortheme 包。对于 markdown,我使用 markdown-mode 和 polymode(对于 Rmd)。
这是一个演示 Rmd
---
title: "Demo"
author: "me"
date: "08.09.17"
---
# Title
Here is some text. This is inline code `paste("Hello world")`. This is
a code block:
```{r this should be dark gray}
head(iris)
```
And thats it.
问题是,如何自定义多模态。它使代码块的背景稍微变亮。
我认为这是polymode-methods.el
的相关部分:
(defun pm--get-adjusted-background (prop)
;; if > lighten on dark backgroun. Oposite on light.
(color-lighten-name (face-background 'default)
(if (eq (frame-parameter nil 'background-mode) 'light)
(- prop) ;; darken
prop)))
看起来您要自定义的面孔是 markdown-pre-face
(对于缩进代码块)和 markdown-inline-code-face
(对于内联代码)。
如果您愿意,可以通过 customize-face
更改这两个面孔。
如果将光标放在代码块中并 运行 M-x describe-face
,您可以自己解决这个问题。默认选择是针对光标所在的面。
我想更改 emacs markdown-mode 的背景颜色,但只更改代码部分,主要是因为我希望它们很容易与其他部分区分开来。我浏览了一些颜色主题,但似乎找不到合适的变量来执行此操作。
我在 'Andreas' 主题上使用略有修改的版本的 colortheme 包。对于 markdown,我使用 markdown-mode 和 polymode(对于 Rmd)。
这是一个演示 Rmd
---
title: "Demo"
author: "me"
date: "08.09.17"
---
# Title
Here is some text. This is inline code `paste("Hello world")`. This is
a code block:
```{r this should be dark gray}
head(iris)
```
And thats it.
问题是,如何自定义多模态。它使代码块的背景稍微变亮。
我认为这是polymode-methods.el
的相关部分:
(defun pm--get-adjusted-background (prop)
;; if > lighten on dark backgroun. Oposite on light.
(color-lighten-name (face-background 'default)
(if (eq (frame-parameter nil 'background-mode) 'light)
(- prop) ;; darken
prop)))
看起来您要自定义的面孔是 markdown-pre-face
(对于缩进代码块)和 markdown-inline-code-face
(对于内联代码)。
如果您愿意,可以通过 customize-face
更改这两个面孔。
如果将光标放在代码块中并 运行 M-x describe-face
,您可以自己解决这个问题。默认选择是针对光标所在的面。