.emacs.d / libs / rainbow-text.el

The fluss branch has multiple heads

; show normal text in rainbow colors
(setq rainbow-text-char-colors 
      '(("a" "#ade") ; hellblau
        ("ä" "#853") ; lehmbraun
        ("b" "#dbf") ; 
        ("c" "#f11" );zinnoberrot
        ("d" "#008" );dunkelblau
        ("e" "#90d" );dunkelviolett
        ("f" "#ddd" );hellgrau
        ("g" "#4b3" );grasgrün
        ("h" "#e8e" );silberviolett
        ("ch" "#808" ); violett
        ("i" "#acc" );hellopalisierend
        ("j" "#055" );dunkelopalisierend
        ("k" "#89a" );silberblau
        ("l" "#175" );dunkelgrün
        ("m" "#067" );blaugrün
        ("n" "#800" );dunkelrot
        ("o" "#148" );ultramarin
        ("ö" "#842" );dunkelorange
        ("p" "#031" );dunkelgrün
        ("r" "#fc0" );golden
        ("s" "#f06" );purpurrot
        ("sch" "#f00" ); feuerrot
        ("t" "#221" );braunschwarz
        ("u" "#111" );samtschwarz
        ("w" "#227" );lila
        ("y" "#fcc" );rosa
        ("ü" "#fcc" );rosa
        ("z" "#ffa" );hellgelb

(defun rainbow-text-colorize (&optional begin end length)
  "colorize a buffer by its chars."
  (let (
        (begin (if (not begin)
        (end (if (not end)
    (loop for i from begin to (1- end)
                 (color (concat "#" 
                                (number-to-string (+ 4 (mod i 5)))
                                (number-to-string (+ 2 (mod i 7)))
                                (number-to-string (mod i 9))))
                 (charcolor (nth 1 (assoc (char-to-string (char-after i)) rainbow-text-char-colors)))
              (if charcolor
                  (put-text-property i (1+ i) 'font-lock-face `(:foreground ,charcolor))
                (put-text-property i (1+ i) 'font-lock-face `(:foreground ,color))))))))
(defun rainbow-text-add-hook () 
  "Initialize rainbow text for this buffer."
  (add-hook 'after-change-functions 'rainbow-text-colorize))

(provide 'rainbow-text)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.