diff --git a/htdp-lib/2htdp/private/image-more.rkt b/htdp-lib/2htdp/private/image-more.rkt index 9a6c8b6c..93a2f791 100644 --- a/htdp-lib/2htdp/private/image-more.rkt +++ b/htdp-lib/2htdp/private/image-more.rkt @@ -1584,7 +1584,7 @@ (bytes-set! bytes (+ j 3) (color-blue c))] [else (define str (if (string? c) c (symbol->string c))) - (define clr (or (send the-color-database find-color str) + (define clr (or (string->color-object/f str) (send the-color-database find-color "black"))) (bytes-set! bytes j 255) ;; this should probably (send clr alpha) when that's possible (bytes-set! bytes (+ j 1) (send clr red)) diff --git a/htdp-test/2htdp/tests/test-image.rkt b/htdp-test/2htdp/tests/test-image.rkt index 1d4e8b99..70ea01df 100644 --- a/htdp-test/2htdp/tests/test-image.rkt +++ b/htdp-test/2htdp/tests/test-image.rkt @@ -2216,6 +2216,15 @@ (rectangle 1 1 'solid (color 5 5 5)) (rectangle 1 1 'solid (color 6 6 6))))) +(test (equal? (color-list->bitmap (list "MediumGreen") 1 1) + (color-list->bitmap (list "black") 1 1)) + => + #f) +(test (equal? (color-list->bitmap (list "DarkPink") 1 1) + (color-list->bitmap (list "black") 1 1)) + => + #f) + (test (color-list->bitmap '() 0 0) => (empty-scene 0 0)) (test (color-list->bitmap '() 0 10) => (empty-scene 0 10)) (test (color-list->bitmap '() 4 0) => (empty-scene 4 0))