require "sinatra" require "byebug" require "rainbow_colors" require "pp" set :public_folder, File.dirname(__FILE__) get '/' do @triad = [] @analogous = [] @complementary = [] @complementary_split = [] @tints = [] @shades = [] for i in 0..30 cp = RainbowColors::Scheme.new RainbowColors::Palette.random_color @triad.push cp.triad @analogous.push cp.analogous @complementary.push cp.complementary @complementary_split.push cp.complementary_split @tints.push cp.tints @shades.push cp.shades end erb :index end get '/hex/:hex' do @triad = [] @analogous = [] @complementary = [] @complementary_split = [] @tints = [] @shades = [] cp = RainbowColors::Scheme.new "##{params[:hex]}" @triad.push cp.triad @analogous.push cp.analogous @complementary.push cp.complementary @complementary_split.push cp.complementary_split @tints.push cp.tints @shades.push cp.shades erb :index end get "/image" do image = RainbowColors::ImagePalette.new params[:img] colors = image.scheme pp image.color_background pp image.color_text pp image.color_accent erb :image, locals: { colors: colors, image: params[:img] } end