Skip to content

Instantly share code, notes, and snippets.

@escherize
Created August 22, 2014 06:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save escherize/68d6718f407022507246 to your computer and use it in GitHub Desktop.
Save escherize/68d6718f407022507246 to your computer and use it in GitHub Desktop.
(setq cider-known-endpoints '(("local-eccentrica-reporting" "127.0.0.1" "5111")
("local-eccentrica-api" "127.0.0.1" "5101")
("local-betelgeuse" "127.0.0.1" "7101")))
(set-face-font 'default "Inconsolata-20")
(fset 'org-jira-link
(lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([67108925 67108925 23 91 91 104 116 116 112 115 58 47 47 115 116 97 112 108 101 115 108 97 98 115 46 97 116 108 97 115 115 105 97 110 46 110 101 116 47 98 114 111 119 115 101 47 25 93 91 74 105 114 97 32 84 105 99 107 101 116 32 40 25 41 93 93 2] 0 "%d")) arg)))
(global-hl-line-mode -1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; colors ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Bryan Maass
;; blending adding subtracting colors in elisp
(defun rgb->r (rgb) (car rgb))
(defun rgb->g (rgb) (cadr rgb))
(defun rgb->b (rgb) (caddr rgb))
(defun color->rgb (c)
(let ((step (if (= (length c) 7) 2 1))
(sc (if (= (length c) 7) 1 17)))
(list (* sc (string-to-number (substring c 1 (+ 1 step)) 16))
(* sc (string-to-number (substring c (+ 1 step) (+ 1 (* 2 step))) 16))
(* sc (string-to-number (substring c (+ 1 (* 2 step)) (+ 1 (* 3 step))) 16)))))
(defun rgb->color (rgb)
(concat "#"
(format "%02x" (rgb->r rgb))
(format "%02x" (rgb->g rgb))
(format "%02x" (rgb->b rgb))))
(defun int->hex-str (n)
(cond
((> n 255) "FF")
((< n 0) "00")
(t (upcase (format "%02x" n)))))
(defun bounded (x) (min 255 (max 0 x)))
(defun color-fn (c1 c2 fn)
(let ((rgb1 (color->rgb c1))
(rgb2 (color->rgb c2)))
(rgb->color
(list (bounded (funcall fn (rgb->r rgb1) (rgb->r rgb2)))
(bounded (funcall fn (rgb->g rgb1) (rgb->g rgb2)))
(bounded (funcall fn (rgb->b rgb1) (rgb->b rgb2)))))))
(defun color-blend (c1 c2)
(color-fn c1 c2 (lambda (a b) (/ (+ a b) 2))))
(defun color-add (c1 c2)
(color-fn c1 c2 (lambda (a b) (+ a b))))
(defun color-minus (c1 c2)
(color-fn c1 c2 (lambda (a b) (- a b))))
(defun color-times (c1 c2)
(color-fn c1 c2 (lambda (a b) (* a b))))
(defun color-random ()
(rgb->color (list (random 256) (random 256) (random 256))))
(defun mute-rand () (color-blend (color-random) (color-random))) ;;less bold
(defun muter-rand () (color-blend (mute-rand) (mute-rand))) ;;lesser bold
(defun mutest-rand () (color-blend (muter-rand) (muter-rand))) ;;more grayish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment