<-component
+ color
green+ color
for/ image
Version: 5.3

Color Utilities

 (require (planet dsheap/color-utils:1:=3))

These are some convenience tools to transform images in the 2htdp/image library. The convenience consists of producing new colors by changing a single intensity by name, and a for-like comprehension for images.

procedure

(<-component band old)  (color)

  band : symbol?
  old : color?
Produces band portion of old’s color.

procedure

(+color component val col)  (color)

  component : symbol?
  val : number?
  col : color?
Produces color based on old, but using intensity val in band corresponding to component.

procedure

(green+color val col)  (color)

  val : number?
  col : color?
Produces color based on col, but with the green intensity to val.

Example:

> (green+color 10 (color 1 2 3 4))

(color 1 10 3 4)

syntax

(for/image ([id image-expr] ...)
  body ...+)
Produce new image by binding id to each element of image-expr’s color-list in turn.