Skip to content

A comprehensive, up-to-date collection of information about crypto tokens.

License

Notifications You must be signed in to change notification settings

ngraveio/assets

Repository files navigation

Assets

Setup

  1. Install python3 on your system.
  2. Install pip on your system.
  3. run python -m venv venv to create a virtual environment
  4. run source venv/bin/activate to activate the virtual environment
  5. run pip install -r requirements.txt to install all the dependencies
  6. run deactivate to deactivate the virtual environment
  7. Optional: you can install recommended extensions for VSCode from .vscode/extensions.json

Overview

Asset repository containing all the assets used in the project in both .png and .svg formats.

Adding coins to the repository

There are options:

  1. Using the script to add icons. You can see configuration options below.
    • add icons to input folder
    • run the script
    • if some icons are not added, probably assets.json misses info about icon
    • add missing icons to assets.json and rerun the script
  2. Manual adding of icons
    • Create the correct folder structure
    • Add each icon manually

Config

script.config.json contains the configuration for the project scripts.

Auto Arrange Icons (auto_arrange)

Options

Key Description Example Value
image_extensions List of image extensions to be considered by the script. ["png", "svg"]
input_folder Path to the input folder. input
assets_info_file Path to the assets info file. assets.json
logo_name Specifies the name of icons after they're arranged to the right destination (folder). logo
assets_folder Path to the folder where tokens of the coins should be kept. assets
output_folder Path to the output folder that will contain all the icons of the assets blockchains
supported_chain_ids Chain ids that are currently supported ["ethereum", "elrond"]

Example

example of the config file:

{
  "auto_arrange": {
    "image_extensions": ["png", "svg"],
    "input_folder": "input",
    "assets_info_file": "assets.json",
    "logo_name": "logo",
    "assets_folder": "assets",
    "output_folder": "blockchains",
    "supported_chain_ids": ["ethereum", "elrond"]
  }
  // ... other configs
}

example above results in the following output:

% python3 auto_arrange.py
% tree blockchains
blockchains
├── ethereum
│   ├── logo.png
│   ├── logo.svg
│   ├── assets
│   │   ├── 0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e
│   │   │   ├── logo.png
│   │   │   └── logo.svg
│   │   ├── 0x0c10bf8fcb7bf5412187a595ab97a3609160b5c6
│   │   │   ├── logo.png
.   .   .   └── logo.svg
.   .   .

Compress Existing Icons (compress_icons)

Options

Key Description Example Value
images[].from_name name of the source icon that needs to be resized ./blockchains/**/logo.svg
images[].to_name name of the resized icon (it is placed in the same folder as source icon) logo.png
images[].size desired size of the icon after resizing 256

Example

example of the config file:

{
  "compress_icons": {
    "images": [
      {
        "from_name": "./blockchains/**/logo.png",
        "to_name": "logo64.png",
        "size": 64
      }
    ]
  }
  // ... other configs
}

Convert icons to different formats (convert_icons)

Options

Key Description Example Value
images[].from_name name of the source icon that needs to be converted ./blockchains/**/logo.svg
images[].to_name name of the converted icon (placed in the same folder as source icon) logo.png
images[].size desired size of the icon after converting 256

Example

example of the config file:

{
  "convert_icons": {
    "images": [
      {
        "from_name": "./blockchains/**/logo.svg",
        "to_name": "logo.png",
        "size": 256
      }
    ]
  }
  // ... other configs
}

Add new icon

Pre-requisites

  • python3 installed on your system.

Steps

  1. Put any folder of any structure in the input folder containing the icons.
  2. Open terminal in the root of the project and run the following command:
% python3 auto_arrange.py

Output

  • output folder will be created in the root of the project if not already present.
  • All the image files will be moved to the output folder of the desired structure.

About

A comprehensive, up-to-date collection of information about crypto tokens.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published