Git Product home page Git Product logo

android-icons's Introduction

android-icons

Build Status Dependency Status devDependency Status Semantically Released

Get android icon file names and dimensions (width)

The default icon file names (as used by cordova) and required sizes for android are listed in a JSON file. This information is useful, for example, when you want to generate icons with the required sizes or to create a config.xml file for a PhoneGap/Cordova project or if you just need to create the icons for your android project from one source icon. This information also exists for iOS icons.

Install

$ npm install --save android-icons

Usage

var icons = require('android-icons');

icons();
//=> [{ "name": "mdpi.png", "width": 48 }, { "name": "hdpi.png", "width": 72 }, ... ]

icons({size: '48'})
//=> {name: 'mdpi.png', width: 48}

icons({size: 'xhdpi'})
//=> {name: 'xhdpi.png', width: 96}

API

icons()

Returns an array of icons, each icon being represented by an object with name and width properties.

Notice that icons are always squares, so no height property is provided.

icons(options)

options

Only option for now is size, which can be either a Number or String value. If it is a Number, it represents the width in pixels. If it is a String, you can use "mdpi", "hdpi" etc. to refer to a certain size or the complete file name, e.g. xhdpi.png.

Returns icon object for that size or null.

For example:

icons({size: 'xhdpi'})
//=> {name: 'xhdpi.png', width: 96}

CLI

android-icons logs to stdout in comma-separated values format (csv) by default so you can easy pipe to other commands in UNIX systems.

$ npm install --global android-icons
$ android-icons --help
Get android icon file names and dimensions (width)

Use `--format json` to set output to JSON.
Get specifc icon by size or name by using `--size`.

Examples:
  $ android-icons --size 48
  [email protected],80

  $ android-icons --size 80 --format json
  {"name":"[email protected]","width":80}

  $ android-icons --size small
  icon-small.png,29

Semantic Releases

This module is being semantically released. You can safely use "^1.0.0" in your package.json.

License

MIT © David Pfahler

android-icons's People

Contributors

davidnpma avatar jimwhitelaw avatar greenkeeper[bot] avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.