*** tmcolor.scm 2004/09/28 22:29:55 1.1 --- tmcolor.scm 2004/09/29 21:21:11 *************** *** 13,19 **** ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (texmacs-module (convert tools tmcolor) ! (:export tmcolor tmcolor? rgb255->tmcolor stm->tmcolor tmcolor->stm)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Internal record utilities --- 13,19 ---- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (texmacs-module (convert tools tmcolor) ! (:export tmcolor tmcolor? rgb255->tmcolor stm->tmcolor tmcolor->stm tmcolor->rgb255 name->tmcolor)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Internal record utilities *************** *** 56,61 **** --- 56,80 ---- (if (not c) (texmacs-error "stm->tmcolor" "Bad color name: ~S" name)) c)) + + ;;; I couldn't figure out what stm->tmcolor was suppsed to do + ;;; (or even what stm was supposed to stand for)... so i added my + ;;; own name->tmcolor function. - corey + (define call/cc call-with-current-continuation) + + (define (name->tmcolor name) + (call/cc (lambda (cont) + (map (lambda (c) + (if (== name (tmcolor-name c)) + (cont c))) + texmacs-colors)))) + + (define (tmcolor->rgb255 tmcolor) + (map (lambda (z) (inexact->exact (floor z))) + (map (lambda (x) (* 255 x)) + (tmcolor->list tmcolor)))) + + (define tmcolor->stm tmcolor-name) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;