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   size   valid?   values_at  

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 from the palette file as a string.

Public Instance methods

If a Numeric key is provided, the single colour value at that position will be returned. If a String key is provided, the colour set (an array) for that colour name will be returned.

Loops through each colour.

Loops through each named colour set.

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

Provides the colour or colours at the provided selectors.

[Validate]