trim_logos

Documentation for eth_defi.vault_report.charts.trim_logos function.

trim_logos(logo_uris, size=96)

Remove the transparent margins around logos.

Logo files come with different amounts of empty space around the mark, so icons drawn in same-sized boxes look unevenly spaced from their text. The logos are rasterised, cropped to their visible pixels and re-encoded as PNG, and their aspect ratio sizes each icon box to the mark itself.

Parameters
  • logo_uris (set[str]) – PNG or SVG data URIs.

  • size (int) – Raster size of SVG logos in pixels, a few times the drawn icon size.

Returns

Original data URI -> (trimmed PNG data URI, width divided by height). Logos without visible pixels are left out.

Return type

dict[str, tuple[str, float]]