outrun/pict3d-lib.rkt

19 lines
515 B
Racket

#lang racket
(require pict3d)
(provide rgba-hex emitted-hex)
(define (get-hex str)
(let*-values ([(num) (string->number str 16)]
[(scale-n) (lambda (x) (/ x 255))]
[(num blue) (quotient/remainder num 256)]
[(red green) (quotient/remainder num 256)])
(list (scale-n red) (scale-n green) (scale-n blue))))
;; TODO: alpha
(define (rgba-hex str)
(apply rgba (get-hex str)))
(define (emitted-hex str intensity)
(apply emitted `(,@(get-hex str) ,intensity)))