Source

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

The fluss branch has multiple heads

; show normal text in rainbow colors
(setq char-colors '(
                     ("a" "#f00")
))

(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)