module Straightedge::Colors

Public Class Methods

all() click to toggle source
# File lib/straightedge/colors.rb, line 57
def self.all
  palette.list
end
dim(color, factor=0x2A000000) click to toggle source
# File lib/straightedge/colors.rb, line 74
def self.dim(color, factor=0x2A000000) #2A2A2A)
  Colors.hex_value(color) - factor
end
hex_value(color) click to toggle source
# File lib/straightedge/colors.rb, line 70
def self.hex_value(color)
  palette.hex_value_for(color) #rescue color
end
palette() click to toggle source

expose module-level wrappers around the currently-configured palette

# File lib/straightedge/colors.rb, line 53
def self.palette
  @current_palette ||= Straightedge.config.palette
end
pick() click to toggle source
# File lib/straightedge/colors.rb, line 61
def self.pick
  palette.sample
end
random() click to toggle source

stackoverflow.com/questions/1698318/ruby-generate-a-random-hex-color

# File lib/straightedge/colors.rb, line 66
def self.random
  ("%08x" % (rand * 0xffffffff)).to_i(16)
end