Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
;; This file: ;; http://anggtwu.net/elisp/find-erainbowgrid.el.html ;; http://anggtwu.net/elisp/find-erainbowgrid.el ;; (find-angg "elisp/find-erainbowgrid.el") ;; Author: Eduardo Ochs <eduardoochs@gmail.com> ;; Version: 2024mar03 ;; ;; (defun e () (interactive) (find-angg "elisp/find-erainbowgrid.el")) ;; (find-epackage-links 'ct "ct" t) ;; (find-epackage-links 'rainbow-mode) ;; (load "~/elisp/find-erainbowgrid.el") ;; «.ranges» (to "ranges") ;; «.rgb» (to "rgb") ;; «.lab» (to "lab") ;; «.lch» (to "lch") ;; «.hsl» (to "hsl") ;; «.hsv» (to "hsv") ;; «.hpluv» (to "hpluv") ;; «.hsluv» (to "hsluv") ;; «.saturated-colors» (to "saturated-colors") (require 'ct) (defun find-erainbowstring (str) (find-estring str) (rainbow-mode)) (defun ee-makegrid-h (os) (mapconcat 'identity os " ")) (defun ee-makegrid (oss) (mapconcat 'ee-makegrid-h oss "\n")) ;; (find-erainbowstring (ee-makegrid '(("#001020" "#304050") ("#607080" "#90A0B0")))) (defun ee-seq (a b &optional step) (if (not step) (cl-loop for x from a to b collect x) (if (> step 0) (cl-loop for x from a to b by step collect x) (cl-loop for x from b to a by (- step) collect x)))) (defun ee-toward (a b n k) (+ a (/ (* k (- b a)) n))) (defun ee-seqn (a b n) (cl-loop for k from 0 to n collect (ee-toward a b n k))) ;; (ee-seq 100 200 10) ;; (ee-seq 100 200) ;; (ee-seq 200 100) ;; (ee-seq 200 100 -10) ;; (ee-seqn 200 100 10) ;; (ee-seqn 200 100.0 10) (defun find-erainbowgrid (f &optional x0 x1 y0 y1) (find-erainbowstring (ee-makegrid (cl-loop for y in (ee-seqn (or y0 0) (or y1 100) 50) collect (cl-loop for x in (ee-seqn (or x0 0) (or x1 100) 10) collect (funcall f x y)))))) ;; (format "%02X%02X44" 160 200) ;; (find-erainbowgrid (lambda (x y) (format "#%02X%02X44" x y)) 0 255 0 255) ;; (find-erainbowgrid (lambda (x y) (format "(%s %s)" x y))) ;; (find-erainbowgrid (lambda (x y) (ct-make-hsluv 10 x y))) ;; (find-erainbowgrid (lambda (x y) (ct-make-hsluv 0 x y))) ;; (find-erainbowgrid (lambda (x y) (ct-make-hsluv 50 x y))) ;; (find-erainbowgrid (lambda (x y) (ct-make-hsluv x 50 y))) ;; (find-erainbowgrid (lambda (x y) (ct-make-hsluv x y 50))) ;; (find-erainbowgrid (lambda (x y) (ct-make-rgb x y 0))) ;; (find-erainbowgrid (lambda (x y) (ct-make-rgb x 0 y))) ;; (find-erainbowgrid (lambda (x y) (ct-make-rgb 0 x y))) ;; ct-make-rgb (R G B) "Make a color using R*G*B properties." ;; ct-make-hsl (H S L) "Make a color using H*S*L properties." ;; ct-make-hsv (H S V) "Make a color using H*S*V properties." ;; ct-make-hsluv (H S L) "Make a color using H*S*L*uv properties." ;; ct-make-hpluv (H P L) "Make a color using H*P*L*uv properties." ;; ct-make-lab (L A B) "Make a color using L*A*B properties." ;; ct-make-lch (L C H) "Make a color using L*C*H properties." ;; «ranges» (to ".ranges") ;; (find-ctfile "ct.el" "Ranges for RGB are all 0-100") ;; (find-ctfile "ct.el" "Ranges for LAB are {0-100,-100-100,-100-100}") ;; (find-ctfile "ct.el" "Ranges for LCH are {0-100,0-100,0-360}") ;; (find-ctfile "ct.el" "Ranges for HSL are {0-360,0-100,0-100}") ;; (find-ctfile "ct.el" "Ranges for HSV are {0-360,0-100,0-100}") ;; (find-ctfile "ct.el" "Ranges for HPLUV are {0-360,0-100,0-100}") ;; (find-ctfile "ct.el" "Ranges for HSLUV are {0-360,0-100,0-100}") ;; «rgb» (to ".rgb") ;; (find-erainbowgrid (lambda (x y) (ct-make-rgb x y 0)) 0 100 0 100) ;; (find-erainbowgrid (lambda (x y) (ct-make-rgb x 0 y)) 0 100 0 100) ;; (find-erainbowgrid (lambda (x y) (ct-make-rgb 0 x y)) 0 100 0 100) ;; «lab» (to ".lab") ;; (find-erainbowgrid (lambda (x y) (ct-make-lab x y 0)) 0 100 -100 100) ;; (find-erainbowgrid (lambda (x y) (ct-make-lab x 0 y)) 0 100 -100 100) ;; (find-erainbowgrid (lambda (x y) (ct-make-lab 50 x y)) -100 100 -100 100) ;; «lch» (to ".lch") ;; (find-erainbowgrid (lambda (x y) (ct-make-lch x y 0)) 0 100 0 100) ;; (find-erainbowgrid (lambda (x y) (ct-make-lch x 50 y)) 0 100 0 360) ;; (find-erainbowgrid (lambda (x y) (ct-make-lch 50 x y)) 0 100 0 360) ;; «hsl» (to ".hsl") ;; (find-erainbowgrid (lambda (x y) (ct-make-hsl x y 50)) 0 360 0 100) ;; (find-erainbowgrid (lambda (x y) (ct-make-hsl x 100 y)) 0 360 0 100) ;; (find-erainbowgrid (lambda (x y) (ct-make-hsl 40 x y)) 0 100 0 100) ;; «hsv» (to ".hsv") ;; (find-erainbowgrid (lambda (x y) (ct-make-hsv x y 50)) 0 360 0 100) ;; (find-erainbowgrid (lambda (x y) (ct-make-hsv x y 100)) 0 360 0 100) ;; (find-erainbowgrid (lambda (x y) (ct-make-hsv x 100 y)) 0 360 0 100) ;; (find-erainbowgrid (lambda (x y) (ct-make-hsv 40 x y)) 0 100 0 100) ;; «hpluv» (to ".hpluv") ;; (find-erainbowgrid (lambda (x y) (ct-make-hpluv x y 50)) 0 360 0 100) ;; (find-erainbowgrid (lambda (x y) (ct-make-hpluv x 100 y)) 0 360 0 100) ;; (find-erainbowgrid (lambda (x y) (ct-make-hpluv 40 x y)) 0 100 0 100) ;; «hsluv» (to ".hsluv") ;; (find-erainbowgrid (lambda (x y) (ct-make-hsluv x y 50)) 0 360 0 100) ;; (find-erainbowgrid (lambda (x y) (ct-make-hsluv x 100 y)) 0 360 0 100) ;; (find-erainbowgrid (lambda (x y) (ct-make-hsluv 40 x y)) 0 100 0 100) ;; «saturated-colors» (to ".saturated-colors") ;; (find-erainbowgrid (lambda (x y) (ct-make-hsv y x 100)) 0 100 0 360) ;; (find-erainbowbar (lambda (y) (ct-make-hsv y 100 100)) 0 360) ;; Local Variables: ;; coding: utf-8-unix ;; End: