Class RGhost::Color
In: color.rb
Parent: RGhost::PsObject

Creates color for postscript components

Methods

create  

Included Modules

RGhost::RubyToPs

Public Class methods

The method create is a color factory depends when parameter is used. The parameter variate between 0 and 1, if value greatet that 1 will be divided by 100.0 .

Examples

Creating RGB color

String HTML color converter

 Color.create '#FFAA33'

As Symbol will be find in RGhost::Constants::Colors::RGB

 Color.create :red

As Array with 3 elements

 Color.create [0.5, 0.3, 0.5]

Hash with 3 pair of key/value. Valids keys :red, :green and :blue

 Color.create :red => 0.5, :green => 0.3, :blue => 0.5

Hash with 3 pair of key/value. Valids keys :r, :g and :b

 Color.create :r => 0.5, :g => 0.3, :b => 0.5

Creating CMYK color

Hash with 4 pair of key/value. Valids keys :cyan, :magenta, :yellow and :black

  Color.create :cyan=> 1 ,:magenta => 0.3, :yellow => 0, :black => 0

Hash with 4 pair of key/value. Valids keys :c, :m, :y and :b

  Color.create :c=> 1 ,:m => 0.3, :y => 0, :b => 0

Creating Gray color

A single Numeric

 Color.create 0.5

50 percent of black will be divided by 100.0

 Color.create 50

[Validate]