Customization
- Formats: SVG is the default vector output. PNG is raster; PDF currently contains a rasterized schematic. There are no public width, height, or DPI controls.
- Appearance:
SchematicStylesupports background, component, wire, and text colors plus ID/value visibility. Defaults are transparent background, black base ink, and visible IDs and values. Colors use six-digit#RRGGBBhex codes. - Saving: Python writes
circuit.svgin the current directory unless given anotheroutput; useoutput=Noneto keep the result in memory. CLI output settings are saved separately from Python options. - Choose an interface: Interactive CLI settings control format, appearance, and save behavior. Direct CLI commands use output extensions and saved CLI appearance preferences. Python uses function parameters and never inherits CLI settings.
Output formats
CircuitGen creates an SVG schematic, then exports it in the selected format. SVG stays vector; PNG and PDF are raster outputs.
| Format | Extension | Output characteristics | Default and limitations |
|---|---|---|---|
| SVG | .svg | Vector drawing that scales cleanly and can be edited in vector tools. | Default format. SVG dimensions are calculated from the layout. |
| PNG | .png | Raster bitmap at the SVG's intrinsic dimensions (scale 1). | Requires resvg-py; there is no public size or scale option. |
.pdf | PDF page containing a rasterized schematic. | Rasterized at scale 2 and saved at 144 DPI. Requires resvg-py and Pillow; there is no public page-size or DPI option. |
PNG and PDF export raise RuntimeError with an installation message if their required renderer or image package is unavailable. The format choice, filename, and preferences for each interface are described under Output and saving behavior.
Schematic appearance
Pass a SchematicStyle to Python's generate(), from_netlist(), or render() to adjust the drawing. Its defaults are listed below.
| Parameter and type | Accepted values | Default | Effect and restrictions |
|---|---|---|---|
background: str | "transparent", "white", "black", or a six-digit hex color such as "#20252B". | "transparent" | Adds a background behind the schematic. Hex must contain exactly six hexadecimal digits after #; color names, shorthand, and alpha are invalid. Keywords are lowercase. |
component_color: str | None | Six-digit #RRGGBB or None. | None | Recolors component symbol strokes and filled symbol parts. |
wire_color: str | None | Six-digit #RRGGBB or None. | None | Recolors wire strokes and junction dots. |
text_color: str | None | Six-digit #RRGGBB or None. | None | Recolors component IDs, values, pin labels, and symbol marks such as + and −. |
show_component_ids: bool | True or False. | True | Shows or hides IDs such as R1 and D1. Pin labels remain visible when IDs are hidden. |
show_component_values: bool | True or False. | True | Shows or hides values such as 360 Ω or red. IDs, pin labels, and source polarity marks remain visible when values are hidden. |
For the three color fields, None leaves the base ink unchanged. Since the Python functions' color parameter defaults to "#000000", the default base ink is black. background=None is invalid. Invalid style colors raise ValueError. The visibility fields are annotated as bool, but are not strictly type-checked at runtime; pass True or False.
The Python functions also accept color: str (default "#000000") as a single-color ink override. It must be a six-digit hex color or raises ValueError. Use SchematicStyle to set component, wire, and text colors separately.
Rendered examples
These four SVGs use the same 9 V battery, 360 Ω resistor, and red LED netlist. They were rendered by CircuitGen. Transparent output is shown on a light panel so the default black ink stays visible in either website theme.
Transparent background; default ink; IDs and values visible.
background="black" and white component, wire, and text colors.Amber components, blue wires, and dark text on white.
Component IDs and values are off; source polarity marks remain.
Configure customization
Use the tab for your interface. Output behavior and format precedence are summarized in the reference below.
- Interactive CLI
- Command Line
- Python
- Run
circuitand open Settings → Output. Choose File format (SVG, PNG, or PDF) and set the default output directory, overwrite confirmation, automatic opening, and JSON sidecar options. - Open Settings → Schematic Preferences. Choose a transparent, white, black, or custom hex background. Set component, wire, and text colors with the color picker or a hex code; choose Default to leave a color unchanged. Toggle component ID and value visibility.
- Save the settings, then use Generate or Render. Their output directory and filename fields can override the saved folder and name for that schematic. The selected File format controls the saved extension.
Settings start with output directory ., SVG format, overwrite confirmation on, automatic opening off, JSON sidecar off, transparent background, default colors, and both labels visible. A missing folder triggers a create-directory confirmation. If overwrite confirmation is on, the CLI asks before replacing the schematic or sidecar; turn it off to replace without asking.
Use the output extension to choose a format; there is no --format flag:
circuit render led.json -o exports/led.pdf --force
For generate and render, set appearance in the interactive CLI's Settings → Schematic Preferences. Direct commands use those saved colors, background, and visibility choices. They use the saved File format only when no -o path is supplied; with -o, its extension selects the format. Direct commands have no flags for appearance, saved output directory, confirmation prompts, automatic opening, or JSON sidecars. Add --force when you intend to replace an existing output file.
Pass SchematicStyle and output parameters directly. This example uses separate colors and writes a PNG:
from circuitgen import SchematicStyle, from_netlist
style = SchematicStyle(
background="white",
component_color="#B54708",
wire_color="#0969DA",
text_color="#24292F",
)
result = from_netlist(netlist, output="exports/led.png", style=style)
To hide component IDs and values, set show_component_ids=False and show_component_values=False. To create a dark drawing, set background="black" and choose contrasting component, wire, and text colors. optimize=True requests a compact, verified layout when using generate(), from_netlist(), or render().
Python uses only the parameters passed to its functions; it does not load CLI Settings. render() returns SVG text by default or PNG/PDF bytes. from_netlist() and generate() return a CircuitResult and save a file unless output=None is passed.
Output and saving behavior
Format and filename precedence
| Interface and call | Format selection | If the format and filename differ |
|---|---|---|
| Interactive CLI | Settings → Output → File format selects SVG, PNG, or PDF. | A recognized .svg, .png, or .pdf suffix in the filename field is changed to match the selected format. |
Direct circuit command | The extension supplied with -o selects the format. Without -o, the saved File format preference selects it. | Only .svg, .png, and .pdf are accepted. An unsupported extension is an error. |
Python generate() / from_netlist() | A recognized output suffix is inferred if output_format is omitted; otherwise the default is SVG. An explicit output_format takes precedence. | Explicit format controls the data but does not rename the file. For example, output="led.svg", output_format="pdf" writes PDF content to a .svg filename. |
Python CircuitResult.save() | A recognized path suffix is inferred if output_format is omitted; otherwise the result's current format is used. An explicit format takes precedence. | The filename is not changed. Without a recognized suffix, save() uses the result's current format and does not append an extension. |
Python render() | Uses output_format directly, default "svg". | It returns SVG text or PNG/PDF bytes and does not write or infer a filename. |
Python accepts svg, png, and pdf case-insensitively. Unsupported format names raise ValueError. For generate() or from_netlist(), no output path means circuit.svg in the current working directory by default. output=None suppresses the file write and keeps the result in memory.
Paths, overwriting, and optional files
| Behavior | Interactive CLI | Direct CLI commands | Python library |
|---|---|---|---|
| Default folder | Saved Output directory, initially . (current working directory). | Current working directory; the saved CLI output directory is not used. | Current working directory; Python does not load CLI folder settings. |
| Default filename | Generate and pasted JSON use circuit.<format>; rendering a file uses its stem, such as led.<format>. | circuit.<format>. | circuit.svg for generate() and from_netlist() with default arguments. |
| Missing folders | Prompts before creating them. | Creates parent folders for -o automatically. | CircuitResult.save() creates parent folders automatically. |
| Existing file | Prompts by default; disable Confirm before replacing files to replace automatically. | Stops with an error unless --force is supplied. | Replaced automatically when saving. |
| Open after save | Open schematic after saving, off by default, opens the saved file in the system viewer. | Not available. | Not available. |
| JSON sidecar | Save JSON alongside schematic, off by default, writes the netlist beside the image with a .json suffix. | Not available. | Not automatic; use result.netlist and save it yourself if needed. |
Interactive and direct CLI workflows use the CLI's saved appearance preferences. Python does not inherit any CLI setting, including format, output directory, overwrite behavior, automatic opening, or sidecar behavior.
Optional layout optimization
The Python functions generate(), from_netlist(), and render() accept optimize: bool = False. Set it to True to try a bounded set of more compact placements. The engine keeps a candidate only when it routes and passes its connectivity checks; otherwise it keeps the original verified layout. There is no CLI setting or circuit flag for this option.