Class: PSD::SheetColor

Inherits:
LayerInfo show all
Defined in:
lib/psd/layer/info/sheet_color.rb

Overview

This is the color label for a group/layer. Not sure why Adobe refers to it as the “Sheet Color”.

Constant Summary collapse

COLORS =
[
  :no_color,
  :red,
  :orange,
  :yellow,
  :green,
  :blue,
  :violet,
  :gray
]

Instance Attribute Summary

Attributes inherited from LayerInfo

#data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from LayerInfo

#initialize, #skip

Constructor Details

This class inherits a constructor from PSD::LayerInfo

Class Method Details

.should_parse?(key) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/psd/layer/info/sheet_color.rb', line 7

def self.should_parse?(key)
  key == 'lclr'
end

Instance Method Details

#colorObject



32
33
34
# File 'lib/psd/layer/info/sheet_color.rb', line 32

def color
  COLORS[@data[0]]
end

#parseObject



22
23
24
25
26
27
28
29
30
# File 'lib/psd/layer/info/sheet_color.rb', line 22

def parse
  # Only the first entry is used, the rest are always 0.
  @data = [
    @file.read_short,
    @file.read_short,
    @file.read_short,
    @file.read_short
  ]
end