Source

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

The fluss branch has multiple heads

Full commit
; show normal text in rainbow colors
(setq 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" "#fd0" );golden
        ("s" "#f06" );purpurrot
        ("sch" "#f00" ); feuerrot
        ("t" "#221" );braunschwarz
        ("u" "#111" );samtschwarz
        ("w" "#227" );lila
        ("y" "#fcc" );rosa
        ("ü" "#fcc" );rosa
        ("z" "#ffc" );hellgelb
))

(loop for i from 1 to (1- (point-max))
      do 
      (save-excursion
        (let 
            (
             (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)) 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))))))

(provide 'rainbow-text)