问题
It's probably possible, but couldn't find a reference. How can I define a different color to internal links than external ones through my .emacs file?
回答1:
Ancient question, but since it pops up in searches... Org 9 has a revamped system for defining links, using the org-link-parameters
variable. Typically, you modify this through the function ´org-set-link-parameters`, see the org documentation, or the examples here: https://kitchingroup.cheme.cmu.edu/blog/2016/11/04/New-link-features-in-org-9/
回答2:
The following code will display internal links (those beginning with "file:
") in turquoise, instead of blue :
(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)
Notes:
- You'll need
M-x org-mode-restart
to see the changes in your org file ; - A face can only be set once (with
defface
), so if you want to change an already defined face, either change its name or relaunch Emacs ; - Already available faces can be seen with
M-x list-faces-display
; - Available colors for your font can be chosen with
M-x list-colors-display
; - You can set a different face for other links. For instance I chose to have all links executing elisp code, to be displayed in red (the last link in the below screenshot) :
来源:https://stackoverflow.com/questions/19057881/customize-color-of-internal-links-orgmode