Rainbow identifiers mode
Rainbow identifiers mode is an Emacs minor mode providing highlighting of identifiers based on their names. Each identifier gets a color based on a hash of its name.
The package is available in MELPA.
If you have MELPA in
M-x package-install RET rainbow-identifiers RET
If you don't, open
rainbow-identifiers.el in Emacs and call
To toggle the mode
To turn it on automatically in most programming modes:
(add-hook 'prog-mode-hook 'rainbow-identifiers-mode)
To change the colors, change faces
To change the number of colors used, change the variable
Since version 0.1.3 it's possible to change how colors/faces are chosen. By
default the old behavior is used, but it can be changed by setting the variable
rainbow-identifiers-choose-face-function to a function that takes a hash and
returns a face specifier. Currently there are two such functions predefined:
rainbow-identifiers-predefined-choose-face, the default, old behavior.
rainbow-identifiers-cie-l*a*b*-choose-face, will generate colors in the CIE L*a*b* color space without depending on any face. The color generation can be influenced by changing the following variables:
Since version 0.2 it's possible to allow
rainbow-identifiers to override some
of the highlighting done by the major mode or other minor modes by setting
rainbow-identifiers-faces-to-override to a list of faces
Also since version 0.2 it's possible to filter which identifiers are highlighted
by adding functions to the
rainbow-identifiers-filter-functions hook. Only the
identifiers for which all functions in the hook return non-nil are highlighted.