class BasicTableColor::AnimalPresenter

Public Instance Methods

background_color() click to toggle source
# File examples/basic_table_color.rb, line 60
def background_color
  case name
  when 'cat'
    {r: 255, g: 120, b: 0, a: 0.5}
  when 'dog'
    :skyblue
  when 'chicken'
    {r: 5, g: 120, b: 110}
  when 'horse'
    '#13a1fb'
  when 'cow'
    0x12ff02
  end
end
image_description_color() click to toggle source
# File examples/basic_table_color.rb, line 43
def image_description_color
  color = case name
  when 'cat', 'dog', 'horse'
    :dark_blue
  when 'chicken'
    :beige
  when 'cow'
    :brown
  end
  [img, 'Glimmer', color]
end
img() click to toggle source
# File examples/basic_table_color.rb, line 55
def img
  # scale image to 24x24 (can be passed as file path String only instead of Array to avoid scaling)
  [File.expand_path('../icons/glimmer.png', __dir__), 24, 24]
end
mammal_description_color() click to toggle source
# File examples/basic_table_color.rb, line 33
def mammal_description_color
  color = case name
  when 'cat', 'dog', 'horse', 'cow'
    :green
  when 'chicken'
    :red
  end
  [mammal, 'mammal', color]
end
name_color() click to toggle source
# File examples/basic_table_color.rb, line 7
def name_color
  color = case name
  when 'cat'
    :red
  when 'dog'
    :yellow
  when 'chicken'
    :beige
  when 'horse'
    :purple
  when 'cow'
    :gray
  end
  [name, color]
end
sound_color() click to toggle source
# File examples/basic_table_color.rb, line 23
def sound_color
  color = case name
  when 'cat', 'chicken', 'cow'
    :blue
  when 'dog', 'horse'
    {r: 240, g: 32, b: 32}
  end
  [sound, color]
end