On Mon, Jun 30, 2008 at 11:20:44AM -0500, Evan Farrar wrote:
> Shoes.app do
>   (Shoes::COLORS.keys.map{|sym|sym.to_s}.sort-["black"]).each { |color|
>     flow(:width => 175){
>       fill eval(color.to_s)
>       rect 0, 0, 160, 25
>       para color.to_s
>     }
>   }
> end

This is splendid, I would be glad to merge this into the manual.
This also shed light on a bug which was causing the `gray` method to
fail.

Also, I've checked in some new methods to allow you to test for dark
colors.  So you can show `black`.

  c = send(color)
  fill c
  rect 0, 0, 160, 25
  para color, :stroke => c.dark? ? white : black

The new methods are Color#invert, Color#dark?, Color#light?,
Color#black?, Color#white?, Color#opaque?, Color#transparent?.
I will probably add some color mixing methods and a few for altering
HSB as well.

_why

Reply via email to