Color

It would be nice to add some color to our images. No surprises that Doodle has methods to do just this. In addition to layout, Doodle has some simple operators to add a splash of colour to our images. Try these out the methods described in Table pictures:color to see how they work.

Doodle has various ways of creating colours. The simplest are the predefined colours on Color. We use these colors by writing Color.black, Color.blue, and so on.

Here is a small example illustrating these methods in action.

Image
  .circle(100)
  .fillColor(Color.wheat)
  .strokeColor(Color.midnightBlue)
  .strokeWidth(7)

A circle with a dark blue border and a beige fill.

Exercises

Exercise: Evil Eye

Make the image in Figure pictures:evil-eye, designed to look like a traditional amulet protecting against the evil eye. I used cornflowerBlue for the iris, and darkBlue for the outer color, but experiment with your own choices!

No evil eyes here!

Here's my amulet:

Image
  .circle(30)
  .fillColor(Color.black)
  .on(Image.circle(60).fillColor(Color.cornflowerBlue))
  .on(Image.circle(90).fillColor(Color.white))
  .on(Image.circle(150).fillColor(Color.darkBlue))