自定义内部链接orgmode的颜色

时间:2013-09-27 18:42:19

标签: emacs

这可能是可能的,但找不到参考。 如何通过我的.emacs文件为外部链接定义不同的颜色?

2 个答案:

答案 0 :(得分:1)

一个古老的问题,但由于它会在搜索中弹出... Org 9的系统经过了改进,可以使用org-link-parameters变量来定义链接。通常,您可以通过功能“ org-set-link-parameters”修改此内容,请参见org文档或此处的示例:https://kitchingroup.cheme.cmu.edu/blog/2016/11/04/New-link-features-in-org-9/

答案 1 :(得分:1)

以下代码将显示内部链接(以“ file:开头的链接)为绿松石色,而不是蓝色:

  (defface org-link-internal
     '((((class color) (background light)) (:foreground "turquoise1" :underline t))
      (((class color) (background dark)) (:foreground "turquoise1" :underline t))
      (t (:underline t)))
  "Face for internal links."
  :group 'org-faces)

  (org-link-set-parameters "file"
               :face 'org-link-internal)

注释:

  • 您需要M-x org-mode-restart才能看到组织文件中的更改;
  • 一张面孔只能设置一次(使用defface),因此,如果要更改已定义的面孔,请更改其名称或重新启动Emacs;
  • 可以用M-x list-faces-display查看可用的面孔;
  • 可以使用M-x list-colors-display选择字体的可用颜色;
  • 您可以为其他链接设置其他面孔。例如,我选择让所有执行elisp代码的链接显示为红色(下面的屏幕快照中的最后一个链接):

Screenshot of hyperlinks with different colors