summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/graphics/color.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/chickadee/graphics/color.scm b/chickadee/graphics/color.scm
index fc7a1d6..cadd63d 100644
--- a/chickadee/graphics/color.scm
+++ b/chickadee/graphics/color.scm
@@ -25,8 +25,10 @@
#:use-module (chickadee graphics engine)
#:use-module (chickadee graphics gl)
#:use-module (chickadee math)
+ #:use-module (ice-9 format)
#:use-module (ice-9 match)
#:use-module (srfi srfi-9)
+ #:use-module (srfi srfi-9 gnu)
#:use-module (srfi srfi-1)
#:export (make-color
make-color8
@@ -141,6 +143,12 @@
(define-inlinable (color-a color)
(f32vector-ref (unwrap-color color) 3))
+(define (display-color c port)
+ (format port "#<color r: ~1,3f, g: ~1,3f, b: ~1,3f, a: ~1,3f>"
+ (color-r c) (color-g c) (color-b c) (color-a c)))
+
+(set-record-type-printer! <color> display-color)
+
(define* (make-color r g b #:optional (a 1.0))
(wrap-color (f32vector r g b a)))