class ASEPalette::Color

Attributes

name[R]

Name cannot changed once a color is created in order to protect the integrity of unique names in a palette

type[RW]

Public Instance Methods

model() click to toggle source

Get color model

# File lib/ase-palette/color.rb, line 11
def model
  self.class.to_s.split('::').last.downcase.to_sym
end
to_h() click to toggle source

Convert color to hash, necessary for binary representation

# File lib/ase-palette/color.rb, line 25
def to_h
  {
    name: @name,
    model: model,
    data: data,
    type: @type,
  }
end
to_s() click to toggle source

Convert color to string

# File lib/ase-palette/color.rb, line 16
def to_s
  "#{@name}, " \
  "#{model.upcase}: " \
  "#{data.values.join("/")}, " \
  ":#{@type}"
end