Module: Color::RGB::JP::Base::Pallet

### Home Classes Methods

### In Files

- lib/color/rgb/jp/base/pallet.rb

### Methods

- #[]
- #c
- #colors
- #define_color
- #each

### Included Modules

- Color::RGB::JP::Base::Encode
- Enumerable

### Class/Module Index

Quicksearch

- Color
- Color::RGB
- Color::RGB::JP
- Color::RGB::JP::Base
- Color::RGB::JP::Base::ColorName
- Color::RGB::JP::Base::Encode
- Color::RGB::JP::Base::NamedRGB
- Color::RGB::JP::Base::Pallet
- Color::RGB::JP::Compiler
- Color::RGB::JP::Compiler::Command
- Color::RGB::JP::Compiler::Compiler
- Color::RGB::JP::VERSION

No matching classes.

# Color::RGB::JP::Base::Pallet

### Public Instance Methods

[](name, encoding = nil) click to toggle source

    # File lib/color/rgb/jp/base/pallet.rb, line 21
    def [](name, encoding = nil)
      with_internal_encoding(name, encoding) {|n|
        @index[normalize(n)]
      }
    end

c(const, hex, *names) click to toggle source
Alias for: define_color
colors() click to toggle source

    # File lib/color/rgb/jp/base/pallet.rb, line 13
    def colors
      @colors
    end

define_color(const, hex, *names) click to toggle source

    # File lib/color/rgb/jp/base/pallet.rb, line 27
    def define_color(const, hex, *names)
      @colors ||= []
      @index ||= {}

      name = ColorName.new(const, *names)
      rgb = ::Color::RGB.from_html(hex)
      color = NamedRGB.new(name, rgb)
      @colors << color

      [const, *names].compact.each {|e|
        @index[normalize(e)] ||= color
      }
      color
    end

Also aliased as: c
each(&block) click to toggle source

    # File lib/color/rgb/jp/base/pallet.rb, line 17
    def each(&block)
      colors.each(&block)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.