Skip to content

Instantly share code, notes, and snippets.

@lispm
Last active May 13, 2017 06:30
Show Gist options
  • Save lispm/7e1c3f4043b31db44c22fd9204fc290b to your computer and use it in GitHub Desktop.
Save lispm/7e1c3f4043b31db44c22fd9204fc290b to your computer and use it in GitHub Desktop.
(defun sunset (color &key (shift-list '(1 4/3 4/3)))
"Redshifts the #RRGGBB color."
(format nil
"#~{~X~}"
(loop for start in '(1 3 5) and shift in shift-list
collect (truncate (parse-integer color
:start start
:end (+ start 2)
:radix 16)
shift))))
(defun sunset (color &key (shift-list '(1 4/3 4/3)))
"Redshifts the #RRGGBB color."
(format nil
"#~{~X~}"
(mapcar (lambda (start shift)
(truncate (parse-integer color :start start :end (+ start 2) :radix 16)
shift))
'(1 3 5)
shift-list)))
; (sunset "#AABBCC" :shift-list '(1 3/2 4/3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment