;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/grad.el (require 'cl-lib) (require 'color) (defun grad-box (w h &optional char) (or char (setq char ?\s)) (let ((gcols (cl-concatenate 'list (reverse (color-gradient '(0.1 0.1 0.1) '(0.1 0.7 1.0) (* (/ h 2) w))) (color-gradient '(0.05 0.05 0.05) '(0.1 0.9 0.1) (* (/ h 2) w)) ))) (goto-char (point-min)) (cl-loop for c in gcols do (let ((str (char-to-string char))) (insert (propertize str 'face (list :weight 'bold :foreground (color-rgb-to-hex (nth 0 c) (nth 1 c) (nth 2 c)))))) (when (= (current-column) w) (insert "\n"))))) (defun grad-box-buf (c) (interactive) (let ((buf (get-buffer-create "*grad*"))) (with-current-buffer buf (erase-buffer) (grad-box 78 28 c) (goto-char (point-min))) (pop-to-buffer buf))) ;; (eval-buffer) ;; (grad-box-buf ?-) (provide 'grad)