Class: LSP::Color

Inherits:
LSPBase show all
Defined in:
lib/lsp/lsp_types.rb

Overview

export interface Color

/**
 * The red component of this color in the range [0-1].
 */
readonly red: number;
/**
 * The green component of this color in the range [0-1].
 */
readonly green: number;
/**
 * The blue component of this color in the range [0-1].
 */
readonly blue: number;
/**
 * The alpha component of this color in the range [0-1].
 */
readonly alpha: number;

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from LSPBase

#initialize, #to_h, #to_json

Constructor Details

This class inherits a constructor from LSP::LSPBase

Instance Attribute Details

#alphaObject

type: number # type: number # type: number # type: number



137
138
139
# File 'lib/lsp/lsp_types.rb', line 137

def alpha
  @alpha
end

#blueObject

type: number # type: number # type: number # type: number



137
138
139
# File 'lib/lsp/lsp_types.rb', line 137

def blue
  @blue
end

#greenObject

type: number # type: number # type: number # type: number



137
138
139
# File 'lib/lsp/lsp_types.rb', line 137

def green
  @green
end

#redObject

type: number # type: number # type: number # type: number



137
138
139
# File 'lib/lsp/lsp_types.rb', line 137

def red
  @red
end

Instance Method Details

#from_h!(value) ⇒ Object



139
140
141
142
143
144
145
146
# File 'lib/lsp/lsp_types.rb', line 139

def from_h!(value)
  value = {} if value.nil?
  self.red = value['red']
  self.green = value['green']
  self.blue = value['blue']
  self.alpha = value['alpha']
  self
end