-
Notifications
You must be signed in to change notification settings - Fork 68
Switch card background or invert theme
Say you have different card types with different colors or themes but you would like to change the theme quickly without changing all parameters for each method inside Squib::Deck.new()
.
You could use something like the following snippet to have one place to define the color/theme and use that in all map functions. The example inverts the color from white to black for one card type. Use a switch-statement inside the map function to differentiate multiple types.
It's possible to use that for e.g. background color, text color or to choose the correct SVG for that color scheme (e.g. use the white or the black version of an image).
# define the color, e.g. choose between white and black to quickly change the color scheme for the cards.
color = 'black'
background_color = all_cards['Type'].map { |t|
if color == 'black' && t == "Type1" then
"black"
else
"white"
end
}
background color: background_color
text_color = all_cards['Type'].map { |t|
if color == 'black' && t == "Type1" then
"white"
else
"black"
end
}
text str: all_cards['Type'], layout: 'title', color: text_color
svg file: all_cards['Type'].map { |t|
if color == 'black' && t == "Type1" then
"icons/#{t.downcase}-white.svg"
else
"icons/#{t.downcase}.svg"
end
}, layout: 'illustration'
Install: Windows OSX Linux Cygwin
Getting Started
Important
Advanced Squibbing
- The Mighty text Method
- Layouts
- Manipulating PNGs
- Manipulating SVGs
- Vector back end
- Rendering both BW and Color
- Colors
- Configuration Options
Real Project Histories
Squiblets
- Category specific template text
- Combining Multiple Columns
- One Icon Per Location
- One Location, Multiple Icons
- Google Sheets
- Rake Rendering Modes
- Autoscale Fonts
- Marketing Materials
- Autobuild with Guardfiles
- Wireframing with an SVG Editor
- Front to Back Printing
- Versioning Practices
- Icon Library: FontAwesome
- Icon Library: GameIcons
- Combining Multiple Columns
- Combine Multiple CSV Files
- Switch card background or invert theme
Tools
Contributing