Project

game_icons

0.01
Low commit activity in last 3 years
No release in over a year
Access and manipulate the scalable, free icons of game-icons.net
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
>= 0
>= 0
>= 0
 Project Readme

Game Icons Gem Version

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     # absolute path to glass-heart.svg, white-on-black
GameIcons.get('glass-heart.svg').file # .svg extension allowed too
GameIcons.get(:flame).file            # symbols work too
GameIcons.get('glass-heart').string   # the SVG string
GameIcons.get('glass-heart').string   # the SVG string
GameIcons.get('glass-heart').recolor(fg: '333', bg: 'ccc').string # recolor the foreground and background to different shades of gray
GameIcons.get('glass-heart').recolor(fg: '333', bg: 'ccc', fg_opacity: 0.25, bg_opacity: 0.75).string # recolor with opacity c

GameIcons.names                       # returns an array of all names
GameIcons.get('skoll/jeep')           # Add author name to disambiguate names
GameIcons.get('delapouite/jeep')      # Add author name to disambiguate names
GameIcons.get('jeep')                 # Behavior undefined for ambiguous names

Working With Squib

Squib is my other pet project. Here's some example usage:

require 'game_icons' # Be sure to also put this in your Gemfile and run "bundle install"
require 'squib'

Squib::Deck.new do
  #You can access just the file
  svg file: GameIcons.get('glass-heart').file
  #Or you can get the data as a string
  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:

  1. Clone the repository
  2. bundle install
  3. Edit version.rb to be something different for just you (e.g. 0.44.johndoe)
  4. Run rake update from the root of this repo
  5. Run rake install to install the new version of the gem.
  6. 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

  1. Fork it ( https://github.com/[my-github-username]/game_icons/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request