class LanguageServer::Protocol::Interface::Color

Represents a color in RGBA space.

Attributes

attributes[R]

Public Class Methods

new(red:, green:, blue:, alpha:) click to toggle source
# File lib/language_server/protocol/interface/color.rb, line 8
def initialize(red:, green:, blue:, alpha:)
  @attributes = {}

  @attributes[:red] = red
  @attributes[:green] = green
  @attributes[:blue] = blue
  @attributes[:alpha] = alpha

  @attributes.freeze
end

Public Instance Methods

alpha() click to toggle source

The alpha component of this color in the range [0-1].

@return [number]

# File lib/language_server/protocol/interface/color.rb, line 47
def alpha
  attributes.fetch(:alpha)
end
blue() click to toggle source

The blue component of this color in the range [0-1].

@return [number]

# File lib/language_server/protocol/interface/color.rb, line 39
def blue
  attributes.fetch(:blue)
end
green() click to toggle source

The green component of this color in the range [0-1].

@return [number]

# File lib/language_server/protocol/interface/color.rb, line 31
def green
  attributes.fetch(:green)
end
red() click to toggle source

The red component of this color in the range [0-1].

@return [number]

# File lib/language_server/protocol/interface/color.rb, line 23
def red
  attributes.fetch(:red)
end
to_hash() click to toggle source
# File lib/language_server/protocol/interface/color.rb, line 53
def to_hash
  attributes
end
to_json(*args) click to toggle source
# File lib/language_server/protocol/interface/color.rb, line 57
def to_json(*args)
  to_hash.to_json(*args)
end