Class: Compass::Magick::Types::Gradients::ColorStop

Inherits:
Compass::Magick::Type show all
Includes:
Utils
Defined in:
lib/magick/types/gradients.rb

Overview

A type that is used when constructing gradients to have precise control over color stops.

Instance Attribute Summary collapse

Attributes included from Scriptable

#context, #options

Instance Method Summary collapse

Methods included from Utils

#assert_one_of, #assert_type, #to_canvas, #to_chunky_color, #value_of

Methods inherited from Compass::Magick::Type

#to_canvas

Constructor Details

#initialize(offset, color) ⇒ ColorStop

Initializes a new ColorStop instance.

Parameters:

  • offset (Sass::Script::Number)

    The color stop offset, 0-100.

  • color (Sass::Script::Color)

    The color at the offset.



19
20
21
22
23
24
# File 'lib/magick/types/gradients.rb', line 19

def initialize(offset, color)
  assert_type 'offset', offset, Sass::Script::Number
  assert_type 'color',  color,  Sass::Script::Color
  @offset = offset
  @color  = color
end

Instance Attribute Details

#colorSass::Script::Color (readonly)

Returns The color at the offset.

Returns:

  • (Sass::Script::Color)

    The color at the offset.



30
31
32
# File 'lib/magick/types/gradients.rb', line 30

def color
  @color
end

#offsetSass::Script::Number (readonly)

Returns The color stop offset, 0-100.

Returns:

  • (Sass::Script::Number)

    The color stop offset, 0-100.



27
28
29
# File 'lib/magick/types/gradients.rb', line 27

def offset
  @offset
end