Sha256: c4cfdc197c71fefa41465bdc9c851f0664cf0c91732506183a6864500f8ab36e

Contents?: true

Size: 634 Bytes

Versions: 5

Compression:

Stored size: 634 Bytes

Contents

require 'psd/layer_info'

class PSD
  # This is the color label for a group/layer. Not sure why Adobe
  # refers to it as the "Sheet Color".
  class SheetColor < LayerInfo
    def self.should_parse?(key)
      key == 'lclr'
    end

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

    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

    def color
      COLORS[@data[0]]
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
psd-3.9.0 lib/psd/layer/info/sheet_color.rb
psd-3.8.0 lib/psd/layer/info/sheet_color.rb
psd-3.7.0 lib/psd/layer/info/sheet_color.rb
psd-3.6.0 lib/psd/layer/info/sheet_color.rb
psd-3.5.0 lib/psd/layer/info/sheet_color.rb