require 'squib' # Squib::Deck.new cards: 3, layout: 'economy.yml' do # background color: 'white' # rect layout: 'cut' # cut line as defined by TheGameCrafter # rect layout: 'safe' # safe zone as defined by TheGameCrafter # text str: ['Occasion','Qualifier','Virus','Reflection'] , layout: 'title' # text str: 'S.P.A.C.E.', layout: 'description' # save format: :png # end data = Squib.csv file: 'cards.csv' layouts = ['economy.yml', 'space-layout-1.yml'] c1 = '#9f68ed' c2 = '#ed9f68' c3 = '#b5ed68' # conditional coloring # https://squib.readthedocs.io/en/v0.15.0/colors.html?highlight=color#samples bg = c1 fg = c2 Squib::Deck.new cards: data['name'].size, layout: layouts do # background_color = cards['type'].map do |t| # if color == 'bg' && t == 'O' then # 'bg' # else # 'fg' # end # end #background color: background_color background color: bg #background color: '#9f68ed' rect fill_color: fg , x: 78, y: 78, width: '2.25in', height: '3.25in', radius: 32 rect layout: 'cut' # cut line as defined by TheGameCrafter rect layout: 'safe' # safe zone as defined by TheGameCrafter text str: data['name'], layout: 'title' text str: data['type'], layout: 'type' text str: data['text'], layout: 'description' svg file: data['illustration'], layout: 'illustration' save_png save_pdf # Defaults are pretty sensible. showcase file: 'showcase.png' # Here's a more complete example. # Tons of ways to tweak it if you like - check the docs. showcase trim: 32, trim_radius: 32, margin: 100, face: :right, scale: 0.85, offset: 0.95, fill_color: :black, reflect_offset: 25, reflect_strength: 0.1, reflect_percent: 0.4, file: 'showcase2.png' save_png prefix: 'showcase_individual_' # to show that they're not trimmed end