# Pict color specifications

**URL:** <https://racket.discourse.group/t/pict-color-specifications/356>\
**Category:** Questions & Answers\
**Created:** [December 5, 2021, 12:59pm UTC](https://racket.discourse.group/t/pict-color-specifications/356 "2021-12-05T12:59:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dominik.pantucek](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/dominik.pantucek/32/144_2.png) [@dominik.pantucek](https://racket.discourse.group/u/dominik.pantucek)\
**Post date:** [December 5, 2021, 12:59pm UTC](https://racket.discourse.group/t/pict-color-specifications/356/1 "2021-12-05T12:59:29Z")

</div>

I am a bit confused about how the colors are specified in the pict package. The `colorize`[1] procedure allows any of the `color/c`[2] values to be used (although it is explicitly written in the documented contract what that means). However all the pict constructors[3] which accept color specification for various arguments use only `(or/c #f string? (is-a?/c color%))`.

Is there some deeper reasoning behind this or should the pict constructors be updated to allow the same flexibilty as `colorize`? I'd be more than happy to the work.

My impression is that unifying all the contracts to `color/c` and making sure the constructors use it appropriately won't break anything and it will make more coherent experience when using pict.

[1] [4&nbsp;Pict Drawing Adjusters](https://docs.racket-lang.org/pict/Pict_Drawing_Adjusters.html#%28def._%28%28lib._pict%2Fmain..rkt%29)._colorize%29%29  
[2] [9&nbsp;Color Helpers](https://docs.racket-lang.org/pict/Color_Helpers.html#%28def)._%28%28lib.\_pict%2Fcolor..rkt%29.\_color%2Fc%29%29  
[3] [2&nbsp;Basic Pict Constructors](https://docs.racket-lang.org/pict/Basic_Pict_Constructors.html)

---

<div class="post-metadata">

**Author:** ![dominik.pantucek](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/dominik.pantucek/32/144_2.png) [@dominik.pantucek](https://racket.discourse.group/u/dominik.pantucek)\
**Post date:** [December 5, 2021, 1:00pm UTC](https://racket.discourse.group/t/pict-color-specifications/356/2 "2021-12-05T13:00:02Z")

</div>

And apparently, just copy-pasing URLs from the documentation doesn't always work ☹ Sorry for the inconvenience.

---

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [December 5, 2021, 2:18pm UTC](https://racket.discourse.group/t/pict-color-specifications/356/3 "2021-12-05T14:18:53Z")

</div>

Allowing a floats as rgb values would be nice too.

Something like `make-color*`.

[https://docs.racket-lang.org/metapict/index.html#(part.\_ref-colors)](https://docs.racket-lang.org/metapict/index.html#%28part._ref-colors%29)

---

<div class="post-metadata">

**Author:** ![dominik.pantucek](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/dominik.pantucek/32/144_2.png) [@dominik.pantucek](https://racket.discourse.group/u/dominik.pantucek)\
**Post date:** [December 5, 2021, 2:55pm UTC](https://racket.discourse.group/t/pict-color-specifications/356/4 "2021-12-05T14:55:56Z")

</div>

That looks nice and is definitely useful too!  
My motivation is, however, mainly to keep the number of dependencies as low as possible. And currently with `colorize` I do not need to `(require racket/class)` just to allow `(is-a?/c color%)` contract.  
If I understand correctly, supporting floats should be pretty straightforward as the value is simple rounded and clamped in the end. Right?

---

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [December 5, 2021, 3:28pm UTC](https://racket.discourse.group/t/pict-color-specifications/356/5 "2021-12-05T15:28:35Z")

</div>

Right.

Post must be at least 20 characters.
