- Install python3 on your system.
- Install pip on your system.
- run
python -m venv venv
to create a virtual environment - run
source venv/bin/activate
to activate the virtual environment - run
pip install -r requirements.txt
to install all the dependencies - run
deactivate
to deactivate the virtual environment - Optional: you can install recommended extensions for VSCode from .vscode/extensions.json
Asset repository containing all the assets used in the project in both .png
and .svg
formats.
There are options:
- 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
- Manual adding of icons
- Create the correct folder structure
- Add each icon manually
script.config.json contains the configuration for the project scripts.
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 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
. . .
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 of the config file:
{
"compress_icons": {
"images": [
{
"from_name": "./blockchains/**/logo.png",
"to_name": "logo64.png",
"size": 64
}
]
}
// ... other configs
}
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 of the config file:
{
"convert_icons": {
"images": [
{
"from_name": "./blockchains/**/logo.svg",
"to_name": "logo.png",
"size": 256
}
]
}
// ... other configs
}
- python3 installed on your system.
- Put any folder of any structure in the input folder containing the icons.
- Open terminal in the root of the project and run the following command:
% python3 auto_arrange.py
- 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.