Skip to content

Instantly share code, notes, and snippets.

@mpontus
Last active August 29, 2015 14:19
Show Gist options
  • Save mpontus/dc27f0829783ebc0bc1a to your computer and use it in GitHub Desktop.
Save mpontus/dc27f0829783ebc0bc1a to your computer and use it in GitHub Desktop.
(require 'dash)
(require 'color)
(let* ((hs (--map (/ (% (* 62 it) 100) 100.0) (number-sequence 1 18)))
(ss (number-sequence 0.0 1.0 0.2)) (ls (number-sequence .0 1.0 0.1))
(hsls (-table (lambda (a b c) (list a b c)) hs ss ls))
(sample (lambda (hex) (propertize " " 'face (cons 'background-color hex))))
(hsl2hex (-compose (-applify 'color-rgb-to-hex) (-applify 'color-hsl-to-rgb)))
(preview (lambda (lst) (mapconcat (-compose sample hsl2hex) (-flatten lst) "")))
(strs (-map (-partial '-map (-partial '-map (-compose sample hsl2hex))) hsls)))
(with-current-buffer (get-buffer-create "*test*")
(erase-buffer)
(--map (insert (mapconcat 'identity (--map (mapconcat 'identity it "") it) "") ?\n) strs)
(goto-char (point-min))
(display-buffer-below-selected (current-buffer) nil)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment