Skip to content

Instantly share code, notes, and snippets.

@a-sk
Forked from justrp/gist:5697174
Created June 3, 2013 09:57
Show Gist options
  • Save a-sk/5697219 to your computer and use it in GitHub Desktop.
Save a-sk/5697219 to your computer and use it in GitHub Desktop.
(define (h->rgb h)
(define hi (round (/ h 60)))
(define vmin 0)
(define a ( round (* 100 (/ (modulo h 60) 60))))
(define vinc a)
(define vdec (- 100 a))
(print hi)
(cond
((= hi 0) (list (round (* 2.55 100 )) (round (* 2.55 vinc )) (round (* 2.55 vmin ))))
((= hi 1) (list (round (* 2.55 vdec )) (round (* 2.55 100 )) (round (* 2.55 vmin ))))
((= hi 2) (list (round (* 2.55 vmin )) (round (* 2.55 100 )) (round (* 2.55 vinc ))))
((= hi 3) (list (round (* 2.55 vmin )) (round (* 2.55 vdec )) (round (* 2.55 100 ))))
((= hi 4) (list (round (* 2.55 vinc )) (round (* 2.55 vmin )) (round (* 2.55 100 ))))
((= hi 5) (list (round (* 2.55 100 )) (round (* 2.55 vmin )) (round (* 2.55 vdec ))))
)
)
(define (getColor i)
(h->rgb (round (/ (+ (* i (/ 360 Step)) (* (+ i 1) (/ 360 Step)) ) 2)))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment