#+TITLE: Colors layer
#+HTML_HEAD_EXTRA:
[[file:img/rainbow_dash.png]]
* Table of Contents :TOC_4_org:noexport:
- [[Description][Description]]
- [[Install][Install]]
- [[Enable rainbow-identifiers][Enable rainbow-identifiers]]
- [[Enable Nyan cat][Enable Nyan cat]]
- [[Key bindings][Key bindings]]
- [[Rainbow Identifiers][Rainbow Identifiers]]
- [[Rainbow Mode][Rainbow Mode]]
- [[Nyan Mode][Nyan Mode]]
* Description
This layer colors your life with:
- [[https://github.com/Fanael/rainbow-identifiers][rainbow identifiers]] mode will colorize each variables and functions with an
almost unique color. The keywords and the declaration of function colors are
disabled in order to make the colorized variables and functions stand out.
- [[https://julien.danjou.info/projects/emacs-packages][rainbow mode]] displays strings representing colors with the color they
represent as background.
- [[https://github.com/syl20bnr/nyan-mode][nyan mode]] display a Nyan cat progress bar in the mode-line.
* Install
To use this contribution add it to your =~/.spacemacs=
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-configuration-layers '(colors))
#+END_SRC
** Enable rainbow-identifiers
To enable the package =rainbow-identifiers= set the variable
=colors-enable-rainbow-identifiers= to =t=:
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-configuration-layers '(
(colors :variables colors-enable-rainbow-identifiers t)))
#+END_SRC
Saturation and lightness of identifiers can be set per theme by adding
an entry in the variable =colors-theme-identifiers-sat&light=. This
is an alist where the key is a theme symbol and the value is a pair
=(saturation lightness)=.
Example:
#+BEGIN_SRC emacs-lisp
(push '(mytheme . (50 50)) colors-theme-identifiers-sat&light)
#+END_SRC
** Enable Nyan cat
To enable the package =nyan-mode= set the variable
=colors-enable-nyan-cat-progress-bar= to =t=:
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-configuration-layers '(
(colors :variables colors-enable-nyan-cat-progress-bar t)))
#+END_SRC
It may be handy to enable it only in a GUI, you can do it by using
a quasi-quoted list:
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-configuration-layers
=((colors :variables
colors-enable-nyan-cat-progress-bar ,(display-graphic-p))))
#+END_SRC
* Key bindings
The prefix associated with colors is ~C~.
** Rainbow Identifiers
[[file:img/theme-tweaks-python.png]]
=rainbow-identifiers= mode can be toggled on and off with:
~ t C i~
Note that the toggle is local to the current buffer.
The =saturation= and =lightness= of identifier colors can be adjusted live
with the micro-state:
| Key Binding | Description |
|-----------------+------------------------------------------|
| ~ C i s~ | initiate change =saturation= mini-mode |
| ~ C i l~ | initiate change =lightness= mini-mode |
| ~+~ | increase the =saturation= or =lightness= |
| ~-~ | decrease the =saturation= or =lightness= |
| ~=~ | reset the =saturation= or =lightness= |
| ~Any other key~ | leave the change mini-mode |
** Rainbow Mode
[[file:img/rainbow-mode.png]]
=rainbow-mode= mode can be toggled on and off with:
~ t C c~
** Nyan Mode
=nyan-mode= mode can be toggled on and off with:
~ t m n~
Note that the toggle is local to the current buffer.