This package adds random colors to your org tags. In order to make colors random but consistent between same tags, colors are generated from the hash of the tag names.
Since it’s random, results may not make you happy, but there are some custom
fields that you can use as seed
to generate different colors. If you are really
picky, there is already a built-in solution for you, please see org-tag-faces.
This package aims to get rid of setting and updating org-tag-faces
manually for
each tag you use.
Default theme without org-rainbow-tags
:
Default theme with org-rainbow-tags
:
Modus vivendi with org-rainbow-tags
:
Modus operandi with org-rainbow-tags
:
Modus vivendi with org-rainbow-tags
(with a custom face)
Modus operandi with org-rainbow-tags
(with a custom face)
- Clone this repository
- Add these two lines to your init file:
(add-to-list 'load-path "/path/to/org-rainbow-tags/")
(require 'org-rainbow-tags)
(use-package org-rainbow-tags
:straight (:host github :repo "KaratasFurkan/org-rainbow-tags"))
You need to enable package installations from MELPA if you didn’t already. (See: https://melpa.org/#/getting-started)
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
M-x package-install RET org-rainbow-tags RET
(unless (package-installed-p 'org-rainbow-tags)
(package-install 'org-rainbow-tags))
(require 'org-rainbow-tags)
(use-package org-rainbow-tags
:ensure t)
You can run org-rainbow-tags-mode
command in the buffer you wanna colorize the
tags.
If you wanna run this minor mode on org
files automatically, you can add a hook:
(add-hook 'org-mode-hook 'org-rainbow-tags-mode)
To see customization options, you can run M-x customize-group RET
org-rainbow-tags RET
or you can check (defcustom ...)
lines in
org-rainbow-tags.el
.
If you don’t like the auto-generated colors for your favorite tags, you can
change the value of org-rainbow-tags-hash-start-index
between 0-20. This
variable decides which 12 characters of the hash of the tag should be taken to
generate the color.
Example:
(setq org-rainbow-tags-hash-start-index 10)
Full use-package
example:
(use-package org-rainbow-tags
:ensure t
:custom
(org-rainbow-tags-hash-start-index 10)
(org-rainbow-tags-extra-face-attributes
;; Default is '(:weight 'bold)
'(:inverse-video t :box t :weight 'bold))
:hook
(org-mode . org-rainbow-tags-mode))
org-rainbow-tags-mode
colorizes org tags when it’s activated and also when a new
tag is added/updated with org-set-tags-command
or with C-c C-c
on the headline.
However, colors will not updated when you edit the tags manually. If you wanna
update colors in every circumstances, you can add this line to your
configuration:
(add-hook 'org-mode-hook (lambda ()
(add-hook 'post-command-hook
'org-rainbow-tags--apply-overlays nil t)))
This is not default because it may cause performance issues on org files. You can try it and decide if it’s okay or not.