Class: Color::Palette::Gimp

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

from_file(filename)

Create a GIMP palette object from the named file.

from_io(io)

Create a GIMP palette object from the provided IO.

new(palette)

Create a new GIMP palette.

### Public Instance methods

[](key)
each() {|el| ...}

Loops through each colour.

each_name( {|color_name, color_set| ...}

Loops through each named colour set.

valid?()

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

[Validate]