|
SILICON
|
Classes | |
| class | SVGTreeBuilder |
Functions | |
| ET.Element | parse_svg (bytes data) |
| dict | load_palette (Path path=PALETTE_PATH) |
| bool | sanitize_svg (ET.Element root) |
| bytes | serialize (ET.Element root) |
| dict | import_svg (bytes data, Path config=DEFAULT_CONFIG) |
| None | resolve_palette (ET.Element root, dict colors) |
| bytes | optimize (bytes source, Path config) |
| ET.Element | optimize_svg (ET.Element root, Path config) |
| bytes | export_svg (bytes source, dict palette) |
| None | process_file (Path source, Path destination, Path config) |
| str | export_name (str source, set used, bool overwrite=False, reserved=None) |
| bytes | export_archive (list files, dict palette, bool overwrite=False) |
| make_server (list[dict] sources, dict palette, Path config, int port=0) | |
| int | main () |
Variables | |
| str | SVG_NS = "http://www.w3.org/2000/svg" |
| SCRIPT_DIR = Path(__file__).resolve().parent | |
| str | PALETTE_PATH = SCRIPT_DIR.parents[1] / "resources/app/palette.json" |
| str | DEFAULT_CONFIG = SCRIPT_DIR / "svgo.config.mjs" |
| int | MAX_SVG_BYTES = 10 * 1024 * 1024 |
| int | MAX_REQUEST_BYTES = MAX_SVG_BYTES * 6 + 1024 |
Select SVG elements and assign Silicon palette colors in a local browser.
| bytes export_archive | ( | list | files, |
| dict | palette, | ||
| bool | overwrite = False ) |
Definition at line 194 of file normalize.py.
| str export_name | ( | str | source, |
| set | used, | ||
| bool | overwrite = False, | ||
| reserved = None ) |
Match browser naming, keeping archive paths and duplicate names out.
Definition at line 178 of file normalize.py.
| bytes export_svg | ( | bytes | source, |
| dict | palette ) |
Serialize edits to an already optimized document without running SVGO.
Definition at line 164 of file normalize.py.
| dict import_svg | ( | bytes | data, |
| Path | config = DEFAULT_CONFIG ) |
Definition at line 90 of file normalize.py.
| dict load_palette | ( | Path | path = PALETTE_PATH | ) |
Definition at line 47 of file normalize.py.
| int main | ( | ) |
Definition at line 300 of file normalize.py.
| make_server | ( | list[dict] | sources, |
| dict | palette, | ||
| Path | config, | ||
| int | port = 0 ) |
Definition at line 217 of file normalize.py.
| bytes optimize | ( | bytes | source, |
| Path | config ) |
Definition at line 115 of file normalize.py.
| ET.Element optimize_svg | ( | ET.Element | root, |
| Path | config ) |
Definition at line 138 of file normalize.py.
| ET.Element parse_svg | ( | bytes | data | ) |
Definition at line 36 of file normalize.py.
| None process_file | ( | Path | source, |
| Path | destination, | ||
| Path | config ) |
Noninteractive helper; writes only after successful optimization.
Definition at line 172 of file normalize.py.
| None resolve_palette | ( | ET.Element | root, |
| dict | colors ) |
Resolve annotations with the same inline-style precedence as Silicon.
Definition at line 98 of file normalize.py.
| bool sanitize_svg | ( | ET.Element | root | ) |
Keep static SVG; the preview additionally blocks network loads with CSP.
Definition at line 64 of file normalize.py.
| bytes serialize | ( | ET.Element | root | ) |
Definition at line 86 of file normalize.py.
| str DEFAULT_CONFIG = SCRIPT_DIR / "svgo.config.mjs" |
Definition at line 23 of file normalize.py.
| int MAX_REQUEST_BYTES = MAX_SVG_BYTES * 6 + 1024 |
Definition at line 25 of file normalize.py.
| int MAX_SVG_BYTES = 10 * 1024 * 1024 |
Definition at line 24 of file normalize.py.
| str PALETTE_PATH = SCRIPT_DIR.parents[1] / "resources/app/palette.json" |
Definition at line 22 of file normalize.py.
| SCRIPT_DIR = Path(__file__).resolve().parent |
Definition at line 21 of file normalize.py.
| str SVG_NS = "http://www.w3.org/2000/svg" |
Definition at line 20 of file normalize.py.