Commits

Arne Babenhauserheide committed 4cf0750

as interactive function.

Comments (0)

Files changed (1)

libs/rainbow-text.el

 ; show normal text in rainbow colors
-(setq char-colors 
+(setq rainbow-text-char-colors 
       '(("a" "#ade") ; hellblau
         ("ä" "#853") ; lehmbraun
         ("b" "#dbf") ; 
         ("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))))))
+
+(defun rainbow-text-colorize ()
+  "colorize a buffer by its chars."
+  (interactive)
+  (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)) 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)))))))
 
 (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.