Class: Chroma::RgbGenerator::FromRgb

Inherits:
Base
  • Object
show all
Defined in:
lib/chroma/rgb_generator/from_rgb.rb

Instance Method Summary collapse

Methods included from Helpers::Bounders

#bound01, #bound_alpha, #clamp01, #to_percentage

Constructor Details

#initialize(format, rgb) ⇒ FromRgb

Returns a new instance of FromRgb

Parameters:


6
7
8
9
# File 'lib/chroma/rgb_generator/from_rgb.rb', line 6

def initialize(format, rgb)
  @format = format
  @rgb = rgb
end

Instance Method Details

#generateColorModes::Rgb

Generates a ColorModes::Rgb.

Returns:


13
14
15
# File 'lib/chroma/rgb_generator/from_rgb.rb', line 13

def generate
  FromRgbValues.new(@format, @rgb.r, @rgb.g, @rgb.b, @rgb.a).generate
end