Game Icons
RubyGem access to the SVGs on game-icons.net, an awesome library of free icons.
Installation
Add this line to your application's Gemfile:
gem 'game_icons'
And then execute:
$ bundle
Or install it yourself as:
$ gem install game_icons
Usage
require 'game_icons'
GameIcons.get('glass-heart').file
GameIcons.get('glass-heart.svg').file
GameIcons.get(:flame).file
GameIcons.get('glass-heart').string
GameIcons.get('glass-heart').string
GameIcons.get('glass-heart').recolor(fg: '333', bg: 'ccc').string
GameIcons.get('glass-heart').recolor(fg: '333', bg: 'ccc', fg_opacity: 0.25, bg_opacity: 0.75).string
GameIcons.names
GameIcons.get('skoll/jeep')
GameIcons.get('delapouite/jeep')
GameIcons.get('jeep')
Working With Squib
Squib is my other pet project. Here's some example usage:
require 'game_icons'
require 'squib'
Squib::Deck.new do
svg file: GameIcons.get('glass-heart').file
svg data: GameIcons.get('glass-heart').string
svg data: GameIcons.get('glass-heart').recolor(fg: '333', bg: 'ccc').string
end
Deep Customization
You can do a whole lot with SVG data once you get it from this library. Take a look at this PR for some inspiration.
Updating Locally
Sometimes I fall behind GameIcons in updating. If you want to update your gem locally, you can do the following:
- Clone the repository
bundle install
- Edit
version.rb
to be something different for just you (e.g. 0.44.johndoe
) - Run
rake update
from the root of this repo - Run
rake install
to install the new version of the gem. - File bug or pull request to notify me.
We Are Not Game-Icons.net
This is not affiliated with game-icons.net. They are awesome, talented artists who give away their hard work. I'm not them.
That said, the Ruby code surroudning this Gem is MIT licensed. The icons themselves are under a CC BY 3.0. Be sure to attribute them in your work.
Contributing
- Fork it ( https://github.com/[my-github-username]/game_icons/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request