Giter VIP home page Giter VIP logo

yamidaisuke / app-icon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dwmkerr/app-icon

0.0 2.0 1.0 23.44 MB

Automatic icon resizing for Mobile Apps. Supports Native, React Native, Cordova, Xamarin and more. Inspired by cordova-icon.

JavaScript 14.83% Makefile 0.49% Java 53.68% Batchfile 3.09% Objective-C 24.92% Shell 0.33% TypeScript 0.46% HTML 0.43% Swift 0.84% C 0.18% SCSS 0.47% Starlark 0.29%

app-icon's Introduction

app-icon CircleCI codecov dependencies Status devDependencies Status

Automatic icon resizing for Mobile Apps. Supports Native, Cordova and React Native. Also supports labelling of app icons. Inspired by cordova-icon.

Banner

Introduction

This simple tool allows you to create a single icon in your app project, then create icons of all required sizes from it. It currently works for iOS and Android. You can also add labels to your app icons.

Create a single large icon.png, at least 192 pixels square, then run:

npx app-icon generate

In your project root. As long as you are running NPM 5.2 onwards it download and run the tool, generating icons for your project!

Installation

Install with:

npm install -g app-icon

You will need imagemagick installed:

brew install imagemagick          # OSX
sudo apt-get install imagemagick  # Debian/Ubuntu/etc
sudo yum install imagemagick      # CentOS/etc

Usage

The commandline tool can be used to generate icons or label icons.

Generating Icons

Add an icon (ideally at least 192x192 pixels) named icon.png to your project root. To automatically generate icons of all sizes for all app projects in the same folder, run:

app-icon generate

If an iOS project is present, then the icon will be copied at all required sizes to:

./ios/<ProjectName>/Images.xcassets/AppIcon.appiconset

If an Android project is present, then the icon will be copied at all required sizes to:

./android/app/src/main/res

You can limit the platforms which icons are generated for with the --platforms flag, specifying:

app-icon generate --platforms=ios
app-icon generate --platforms=android,ios

By default the tool will generate icons for both platforms.

You can search in specific directories for icons, if the presence of other projects is interfering, just use the --search or -s parameter:

app-icon generate -s ./ios -s ./android

You can specify the path to the source icon, as well as the folder to search for app projects, just run app-icon generate -h to see the options.

Labelling Icons

Add labels to an icon with the command below:

app-icon label -i icon.png -o output.png --top UAT --bottom 0.12.3

This would produce output like the below image:

Labelled Icon Image

This is a useful trick when you are creating things like internal QA versions of your app, where you might want to show a version number or other label in the icon itself.

Coding

The only dependencies are Node 6 (or above) and Yarn.

Useful commands for development are:

Command Usage
npm test Runs the unit tests.
npm run test:debug Runs the tests in a debugger. Combine with .only and debugger for ease of debugging.
npm run cov Runs the tests, writing coverage reports to ./artifacts/coverage.

Currently the linting style is based on airbnb. Run npm run lint to lint the code.

Initial Setup

Install the dependencies (I recommend Node Version Manager):

nvm install 6
nvm use 6
git clone [email protected]:dwmkerr/app-icon.git
cd app-icon
npm install && npm test

Running Tests

Run the tests with:

npm test

Tests are executed with Mocha and coverage is handled by Istanbul. Coverage reports are written to an ./artifacts folder.

Creating a Release

To create a release.

  • Merge your work to master.
  • Use npm version to bump, e.g. npm version patch
  • Push and deploy git push --tags && git push && npm publish

The Sample Projects

This project includes some sample apps in the test folder, which are used for the tests. You can also run these apps to see the icons produced in action.

React Native

To run:

cd ./test/ReactNativeIconTest/
npm install
react-native run-ios
# OR react-native run-android

Cordova

To run:

cd ./test/CordovaApp/
npm install
cordova run ios
# OR cordova run android

Native

To run the native apps, open the ./test/NativeApp directory, then open the iOS/Android projects in XCode/AndroidStudio as needed.

Compatibility

app-icon dependds on ImageMagick. ImageMagick 6 is installed by default on many Linux distributions, as well as OSX. Some platforms are regularly tested (such as Ubuntu, via CircleCI). Other platforms may work but are not tested when I make a release, so your results may vary.

The table below shows the current confirmed compatibility:

Platform app-icon ImageMagick Status
OSX 0.6.x 6, 7 โœ…
Ubuntu 14 0.6.x 6 โœ…

Troubleshooting

Images labelled with app-icon label have the text slightly vertically offset

This seems to be an issue with Imagemagick 6 - try upgrading to 7.

License

MIT

app-icon's People

Contributors

dwmkerr avatar yamidaisuke avatar albkn avatar sampsasaarela avatar fcruzsbtv avatar blackjid avatar martindoyleuk avatar pabloppp avatar raldred avatar robbiet480 avatar samypesse avatar sgdesmet avatar

Watchers

 avatar James Cloos avatar

Forkers

robertxpc

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.