Class: Color::Schemes

Inherits:
Object
  • Object
show all
Defined in:
lib/artsy/colour.rb

Overview

class containing all colour manipulation functions, and variables

Instance Method Summary collapse

Constructor Details

#initialize(filepath = "None") ⇒ Schemes

colour schemes. namespaced under Color. these are essentially the same functions as above, but storing multiple colours in the hash



14
15
16
17
# File 'lib/artsy/colour.rb', line 14

def initialize(filepath = "None")
  # create a new colour scheme
  @scheme = Hash.new
end

Instance Method Details

#out(text, colour) ⇒ Object



24
25
26
27
# File 'lib/artsy/colour.rb', line 24

def out(text, colour)
  # print using a scheme colour
  puts "#{@scheme[colour]}#{text}\033[0m"
end

#setSColor(name, r, g, b) ⇒ Object



19
20
21
22
# File 'lib/artsy/colour.rb', line 19

def setSColor(name, r, g, b)
  # set scheme colour
  @scheme["#{name}"] = "\033[38;2;#{r};#{g};#{b}m"
end