Commits

Arne Babenhauserheide committed 42552ac

can give individual char colors.

Comments (0)

Files changed (1)

libs/rainbow-text.el

 ; show normal text in rainbow colors
+(setq char-colors '(
+                     ("a" "#f00")
+))
+
 (loop for i from 1 to (1- (point-max))
       do 
-      (let 
-          ((foo (make-overlay i (+ i 1)))
-           (color (concat "#" (number-to-string (+ 4 (mod i 5)))
-                                               (number-to-string (+ 2 (mod i 7)))
-                                               (number-to-string (mod i 9))))) 
-        (put-text-property i (1+ i) 'font-lock-face `(:foreground ,color))))
+      (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)