3

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

2 Answers 2

3

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) :

Screenshot of hyperlinks with different colors

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/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.