class Pixelart::Palette8bit
Constants
- BLUE
- BLUE_STOPS
- FALSE
- FALSE_STOPS
- GRAYSCALE
auto-add grayscale 0 to 255
e.g. rgb(0,0,0) rgb(1,1,1) rgb(2,2,2) ... rgb(255,255,255)
- SEPIA
- SEPIA_STOPS
8x32 gradient color stops
see https://en.wikipedia.org/wiki/List_of_software_palettes#Color_gradient_palettes
Public Class Methods
build_palette( gradients )
click to toggle source
# File lib/pixelart/palette.rb, line 56 def self.build_palette( gradients ) colors_per_gradient, mod = 256.divmod( gradients.size ) raise ArgumentError, "8bit palette - 256 must be divisible by # of gradients (#{gradients.size}; expected mod of 0 but got #{mod}" if mod != 0 colors = [] gradients.each do |stops| colors += Gradient.new( *stops ).colors( colors_per_gradient ) end colors end