Skip to main content

Customization

Estimated read~8-11 min
TL;DR
  • 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: SchematicStyle supports 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 #RRGGBB hex codes.
  • Saving: Python writes circuit.svg in the current directory unless given another output; use output=None to 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.

FormatExtensionOutput characteristicsDefault and limitations
SVG.svgVector drawing that scales cleanly and can be edited in vector tools.Default format. SVG dimensions are calculated from the layout.
PNG.pngRaster bitmap at the SVG's intrinsic dimensions (scale 1).Requires resvg-py; there is no public size or scale option.
PDF.pdfPDF 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 typeAccepted valuesDefaultEffect 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 | NoneSix-digit #RRGGBB or None.NoneRecolors component symbol strokes and filled symbol parts.
wire_color: str | NoneSix-digit #RRGGBB or None.NoneRecolors wire strokes and junction dots.
text_color: str | NoneSix-digit #RRGGBB or None.NoneRecolors component IDs, values, pin labels, and symbol marks such as + and −.
show_component_ids: boolTrue or False.TrueShows or hides IDs such as R1 and D1. Pin labels remain visible when IDs are hidden.
show_component_values: boolTrue or False.TrueShows 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.

Battery, resistor, and LED with default appearance
Default
Transparent background; default ink; IDs and values visible.
Battery, resistor, and LED on black with white ink
Dark background
background="black" and white component, wire, and text colors.
Battery, resistor, and LED with amber components, blue wires, and dark text
Custom colors
Amber components, blue wires, and dark text on white.
Battery, resistor, and LED with component IDs and values hidden
Hidden labels
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.

  1. Run circuit and open Settings → Output. Choose File format (SVG, PNG, or PDF) and set the default output directory, overwrite confirmation, automatic opening, and JSON sidecar options.
  2. 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.
  3. 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.

Output and saving behavior​

Format and filename precedence​

Interface and callFormat selectionIf the format and filename differ
Interactive CLISettings → 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 commandThe 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​

BehaviorInteractive CLIDirect CLI commandsPython library
Default folderSaved 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 filenameGenerate 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 foldersPrompts before creating them.Creates parent folders for -o automatically.CircuitResult.save() creates parent folders automatically.
Existing filePrompts by default; disable Confirm before replacing files to replace automatically.Stops with an error unless --force is supplied.Replaced automatically when saving.
Open after saveOpen schematic after saving, off by default, opens the saved file in the system viewer.Not available.Not available.
JSON sidecarSave 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.