Class Color::Palette::Gimp
In: lib/color/palette/gimp.rb
Parent: Object

A class that can read a GIMP (GNU Image Manipulation Program) palette file and provide a Hash-like interface to the contents. GIMP colour palettes are RGB values only.

Because two or more entries in a GIMP palette may have the same name, all named entries are returned as an array.

  pal = Color::Palette::Gimp.from_file(my_gimp_palette)
  pal[0]          => Color::RGB<...>
  pal["white"]    => [ Color::RGB<...> ]
  pal["unknown"]  => [ Color::RGB<...>, Color::RGB<...>, ... ]

GIMP Palettes are always indexable by insertion order (an integer key).

Methods

[]   each   each_name   from_file   from_io   new   valid?  

Included Modules

Enumerable

Attributes

name  [R] 

Public Class methods

Create a GIMP palette object from the named file.

Create a GIMP palette object from the provided IO.

Create a new GIMP palette.

Public Instance methods

Loops through each colour.

Loops through each named colour set.

Returns true if this is believed to be a valid GIMP palette.

[Validate]