diff --git a/package.json b/package.json index 1a0b926..2c71b4a 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "scripts": { "test": "jest --config jestconfig.json --verbose", "gen": "python3 src/gen.py", - "genlogos": "python3 src/gen_logos.py" + "gen-logos": "python3 src/gen_logos.py", + "gen-logos-overwrite": "python3 src/gen_logos.py --overwrite" }, "keywords": [ "wormhole", diff --git a/src/gen_logos.py b/src/gen_logos.py index 81eb737..9879af2 100644 --- a/src/gen_logos.py +++ b/src/gen_logos.py @@ -42,9 +42,10 @@ def get_chain_logo(chain_name): return img -def get_wormhole_logo(): +def get_wormhole_logo(style=None): # bottom right - path = os.path.join(dir_path, 'components', 'wormhole.png') + filename = 'wormhole' if style is None else 'wormhole_%s' % style + path = os.path.join(dir_path, 'components', filename + '.png') img = Image.open(path).resize(MINI_DIM).convert('RGBA') img = add_margin(img, L-S-OFFSET, OFFSET, OFFSET, L-S-OFFSET) return img @@ -82,10 +83,10 @@ def get_base_logo(name): return img.resize(STANDARD_DIM).convert('RGBA') -def get_logo(name, wormhole=True, chain=None): +def get_logo(name, wormhole=True, chain=None, style=None): stack = [get_base_logo(name)] if wormhole: - stack.append(get_wormhole_logo()) + stack.append(get_wormhole_logo(style=style)) if chain is not None: stack.append(get_chain_logo(chain)) @@ -102,12 +103,12 @@ def get_logo_path(name, wormhole=True, chain=None): return os.path.join(ASSET_PATH, '%s.png' % filename) -def write_logo(name, outpath, wormhole=True, chain=None): - composite = get_logo(name, wormhole=wormhole, chain=chain) +def write_logo(name, outpath, wormhole=True, chain=None, style=None): + composite = get_logo(name, wormhole=wormhole, chain=chain, style=style) composite.save(outpath) -def write_logos(overwrite=False): +def write_logos(overwrite=False, style=None): for src_chain, tok_list in TOKENS.items(): tokens = tok_list.keys() for tok in tokens: @@ -115,12 +116,13 @@ def write_logos(overwrite=False): outpath = get_logo_path(tok, wormhole=True, chain=src_chain if use_chain else None) if not overwrite and os.path.exists(outpath): continue - write_logo(tok, outpath, wormhole=True, chain=src_chain if use_chain else None) + write_logo(tok, outpath, wormhole=True, chain=src_chain if use_chain else None, style=style) print('wrote %s' % outpath) if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('--overwrite', '-o', action='store_true') + parser.add_argument('--style', '-s', choices=['barecolor', 'color', 'thickgray', 'thingray', None]) args, unknown_args = parser.parse_known_args() - write_logos(overwrite=args.overwrite) + write_logos(overwrite=args.overwrite, style=args.style) diff --git a/src/logogen/README.md b/src/logogen/README.md index d03ead9..4409603 100644 --- a/src/logogen/README.md +++ b/src/logogen/README.md @@ -18,16 +18,55 @@ USDTpo: ## Instructions ### Base logos -Base logos should be supplied either by adding png files to [src/logogen/base/](base/), -or by adding a logo component to [src/config/token_data.py](../config/token_data.py). +Base logos for token `TOK` should be supplied either by adding `TOK.png` to [src/logogen/base/](base/), +or by adding a `"logo"` entry to the appropriate block for `TOK` in [src/config/token_data.py](../config/token_data.py). If both are present, we'll use the one in [src/logogen/base/](base/), ### Generating new logos +Run: ``` -npm run genlogos +npm run gen-logos +``` + +This won't write over any existing images in [assets](../../assets]. To overwrite the existing assets: +``` +npm run gen-logos-overwrite ``` ### Linking to logos ``` https://raw.githubusercontent.com/certusone/wormhole-token-list/main/assets/CAKE_wh.png -``` \ No newline at end of file +``` + +## Styling + +A few style choices are included (with examples): + +thick_gray (default): + +![CAKE](examples/CAKE_wh_thick_gray.png) +![UST](examples/UST_wh_thick_gray.png) + +thin_gray: + +![CAKE](examples/CAKE_wh_thin_gray.png) +![UST](examples/UST_wh_thin_gray.png) + +color: + +![CAKE](examples/CAKE_wh_color.png) +![UST](examples/UST_wh_color.png) + +barecolor: + +![CAKE](examples/CAKE_wh_barecolor.png) +![UST](examples/UST_wh_barecolor.png) + +These variants are in [src/logogen/components](components/). + +To generate all the outputs with a different style from the default, run: +``` +python3 gen_logos.py --overwrite --style STYLE +``` + +To update the default style, copy one of them to [src/logogen/components/wormhole.png](components/wormhole.png). \ No newline at end of file diff --git a/src/logogen/components/wormhole_bare.png b/src/logogen/components/wormhole_barecolor.png similarity index 100% rename from src/logogen/components/wormhole_bare.png rename to src/logogen/components/wormhole_barecolor.png diff --git a/src/logogen/components/wormhole_rounded.png b/src/logogen/components/wormhole_color.png similarity index 100% rename from src/logogen/components/wormhole_rounded.png rename to src/logogen/components/wormhole_color.png diff --git a/src/logogen/components/wormhole_thick_gray.png b/src/logogen/components/wormhole_thick_gray.png new file mode 100644 index 0000000..e3adf2b Binary files /dev/null and b/src/logogen/components/wormhole_thick_gray.png differ diff --git a/src/logogen/components/wormhole_thin.png b/src/logogen/components/wormhole_thin_gray.png similarity index 100% rename from src/logogen/components/wormhole_thin.png rename to src/logogen/components/wormhole_thin_gray.png diff --git a/src/logogen/examples/CAKE_wh_barecolor.png b/src/logogen/examples/CAKE_wh_barecolor.png new file mode 100644 index 0000000..4a409a0 Binary files /dev/null and b/src/logogen/examples/CAKE_wh_barecolor.png differ diff --git a/src/logogen/examples/CAKE_wh_color.png b/src/logogen/examples/CAKE_wh_color.png new file mode 100644 index 0000000..595970e Binary files /dev/null and b/src/logogen/examples/CAKE_wh_color.png differ diff --git a/src/logogen/examples/CAKE_wh_thick_gray.png b/src/logogen/examples/CAKE_wh_thick_gray.png new file mode 100644 index 0000000..9e3504a Binary files /dev/null and b/src/logogen/examples/CAKE_wh_thick_gray.png differ diff --git a/src/logogen/examples/CAKE_wh_thin_gray.png b/src/logogen/examples/CAKE_wh_thin_gray.png new file mode 100644 index 0000000..230b2e7 Binary files /dev/null and b/src/logogen/examples/CAKE_wh_thin_gray.png differ diff --git a/src/logogen/examples/UST_wh_barecolor.png b/src/logogen/examples/UST_wh_barecolor.png new file mode 100644 index 0000000..367097a Binary files /dev/null and b/src/logogen/examples/UST_wh_barecolor.png differ diff --git a/src/logogen/examples/UST_wh_color.png b/src/logogen/examples/UST_wh_color.png new file mode 100644 index 0000000..2091dfb Binary files /dev/null and b/src/logogen/examples/UST_wh_color.png differ diff --git a/src/logogen/examples/UST_wh_thick_gray.png b/src/logogen/examples/UST_wh_thick_gray.png new file mode 100644 index 0000000..1b24823 Binary files /dev/null and b/src/logogen/examples/UST_wh_thick_gray.png differ diff --git a/src/logogen/examples/UST_wh_thin_gray.png b/src/logogen/examples/UST_wh_thin_gray.png new file mode 100644 index 0000000..4c9b0e8 Binary files /dev/null and b/src/logogen/examples/UST_wh_thin_gray.png differ