From ed6fb016d91b924fd8459c9115fae0cf86883db9 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 15 Oct 2020 18:38:52 -0400 Subject: graphics: color: Add DawnBringer 32-color palette. --- chickadee/graphics/color.scm | 158 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 132 insertions(+), 26 deletions(-) diff --git a/chickadee/graphics/color.scm b/chickadee/graphics/color.scm index 2e1bf43..e8026ba 100644 --- a/chickadee/graphics/color.scm +++ b/chickadee/graphics/color.scm @@ -28,23 +28,91 @@ #:use-module (srfi srfi-9) #:use-module (srfi srfi-1) #:export (make-color + make-color8 color? - color-r color-g color-b color-a - rgba rgb transparency string->color - color* color+ color- color-inverse color-lerp - - white black red green blue yellow magenta cyan transparent - tango-light-butter tango-butter tango-dark-butter - tango-light-orange tango-orange tango-dark-orange - tango-light-chocolate tango-chocolate tango-dark-chocolate - tango-light-chameleon tango-chameleon tango-dark-chameleon - tango-light-sky-blue tango-sky-blue tango-dark-sky-blue - tango-light-plum tango-plum tango-dark-plum - tango-light-scarlet-red tango-scarlet-red tango-dark-scarlet-red - tango-aluminium-1 tango-aluminium-2 tango-aluminium-3 - tango-aluminium-4 tango-aluminium-5 tango-aluminium-6 - - make-color-mask + color-r + color-g + color-b + color-a + rgba + rgb + transparency + string->color + color* + color+ + color- + color-inverse + color-lerp + + white + black + red + green + blue + yellow + magenta + cyan + + tango-light-butter + tango-butter + tango-dark-butter + tango-light-orange + tango-orange + tango-dark-orange + tango-light-chocolate + tango-chocolate + tango-dark-chocolate + tango-light-chameleon + tango-chameleon + tango-dark-chameleon + tango-light-sky-blue + tango-sky-blue + tango-dark-sky-blue + tango-light-plum + tango-plum + tango-dark-plum + tango-light-scarlet-red + tango-scarlet-red + tango-dark-scarlet-red + tango-aluminium-1 + tango-aluminium-2 + tango-aluminium-3 + tango-aluminium-4 + tango-aluminium-5 + tango-aluminium-6 + + db32-black + db32-valhalla + db32-loulou + db32-oiled-cedar + db32-rope + db32-tahiti-gold + db32-twine + db32-pancho + db32-golden-fizz + db32-atlantis + db32-christi + db32-elf-green + db32-dell + db32-verdigris + db32-opal + db32-deep-koamaru + db32-venice-blue + db32-royal-blue + db32-cornflower + db32-viking + db32-light-steel-blue + db32-white + db32-heather + db32-topaz + db32-dim-gray + db32-smokey-ash + db32-clairvoyant + db32-brown + db32-mandy + db32-plum + db32-stinger + default-color-mask null-color-mask color-mask? @@ -71,7 +139,7 @@ (define-inlinable (color-a color) (f32vector-ref (unwrap-color color) 3)) -(define-inlinable (make-color r g b a) +(define* (make-color r g b #:optional (a 1.0)) (wrap-color (f32vector (clamp 0.0 1.0 r) @@ -79,6 +147,9 @@ (clamp 0.0 1.0 b) (clamp 0.0 1.0 a)))) +(define* (make-color8 r g b #:optional (a 255)) + (make-color (/ r 255.0) (/ g 255.0) (/ b 255.0) (/ a 255.0))) + (define (color-component color-code offset) "Return the value of an 8-bit color channel in the range [0,1] for the integer COLOR-CODE, given an OFFSET in bits." @@ -188,15 +259,14 @@ a color object." ;;; ;; Basic -(define white (rgb #xffffff)) -(define black (rgb #x000000)) -(define red (rgb #xff0000)) -(define green (rgb #x00ff00)) -(define blue (rgb #x0000ff)) -(define yellow (rgb #xffff00)) -(define magenta (rgb #xff00ff)) -(define cyan (rgb #x00ffff)) -(define transparent (make-color 0 0 0 0)) +(define white (make-color 1.0 1.0 1.0)) +(define black (make-color 0.0 0.0 0.0)) +(define red (make-color 1.0 0.0 0.0)) +(define green (make-color 0.0 1.0 0.0)) +(define blue (make-color 0.0 0.0 1.0)) +(define yellow (make-color 1.0 1.0 0.0)) +(define magenta (make-color 1.0 0.0 1.0)) +(define cyan (make-color 0.0 1.0 1.0)) ;; Tango color pallete ;; http://tango.freedesktop.org @@ -228,6 +298,42 @@ a color object." (define tango-aluminium-5 (rgb #x555753)) (define tango-aluminium-6 (rgb #x2e3436)) +;; DawnBringer 32 color palette +;; http://pixeljoint.com/forum/forum_posts.asp?TID=16247 +;; Color names taken from: http://privat.bahnhof.se/wb364826/pic/db32.gpl +(define db32-black (make-color8 0 0 0)) +(define db32-valhalla (make-color8 34 32 52)) +(define db32-loulou (make-color8 69 40 60)) +(define db32-oiled-cedar (make-color8 102 57 49)) +(define db32-rope (make-color8 143 86 59)) +(define db32-tahiti-gold (make-color8 223 113 38)) +(define db32-twine (make-color8 217 160 102)) +(define db32-pancho (make-color8 238 195 154)) +(define db32-golden-fizz (make-color8 251 242 54)) +(define db32-atlantis (make-color8 153 229 80)) +(define db32-christi (make-color8 106 190 48)) +(define db32-elf-green (make-color8 55 148 110)) +(define db32-dell (make-color8 75 105 47)) +(define db32-verdigris (make-color8 82 75 36)) +(define db32-opal (make-color8 50 60 57)) +(define db32-deep-koamaru (make-color8 63 63 116)) +(define db32-venice-blue (make-color8 48 96 130)) +(define db32-royal-blue (make-color8 91 110 225)) +(define db32-cornflower (make-color8 99 155 255)) +(define db32-viking (make-color8 95 205 228)) +(define db32-light-steel-blue (make-color8 203 219 252)) +(define db32-white (make-color8 255 255 255)) +(define db32-heather (make-color8 155 173 183)) +(define db32-topaz (make-color8 132 126 135)) +(define db32-dim-gray (make-color8 105 106 106)) +(define db32-smokey-ash (make-color8 89 86 82)) +(define db32-clairvoyant (make-color8 118 66 138)) +(define db32-brown (make-color8 172 50 50)) +(define db32-mandy (make-color8 217 87 99)) +(define db32-plum (make-color8 215 123 186)) +(define db32-rain-forest (make-color8 143 151 74)) +(define db32-stinger (make-color8 138 111 48)) + ;;; ;;; Color Masks -- cgit v1.2.3