Repository navigation
Host-pushed styling: style_response for nets, instances and pins - #47
Merged
Merged
Conversation
Colors, stroke widths, fills and labels a host puts on the netlist, kept in StyleStore, re-sent after every root load like diagnoses, and drawn through the painter so they reach SVG and headless exports. Precedence: diagnosis > style > trace colors. Python: style() on ViewerSession/ViewerServer/Schematic, show(style=), export_svg(style=), --style on the server and render CLIs; net items are resolved to their net's driver, per bit. Native: --style, kept by --export.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A host can now style the netlist it shows: colors, stroke widths, fills and labels on nets, instances and pins. For example, a fanout-fix report showing the enable net in orange, each driver copy's net in its own color, and the sinks tinted to match, with no SVG post-processing.
Wire format
A new
style_responseserver push:{ "response": "style_response", "items": [ { "kind": "net", "id_path": [3], "path": ["drv_0"], "terminal": "O", "bit": 0, "color": "#1f77b4", "width": 2.5, "fill": "#1f77b455", "label": "copy 0" } ] }#rrggbbaatints the default fill), outline color/width, label replaces the drawn nameItems on the same object merge in order.
Viewer (C++)
StyleStore(same static-store pattern asDiagnosisStore), cleared on every root load. Hosts re-send styles after eachroot_response, like diagnoses.EquipotentialViewwhile building shapes and drawn bySchematicViewthrough the painter, so styles show on screen, in File > Export SVG, in native--exportand in the headless renderer.--style <file>(loadStyleFile()), also used by--export.Python
style(items)onViewerSession,ViewerServerandSchematic;show(style=),design_changed(style=),export_svg(style=)/export_svgsjobs,naja_schematic.style_response().--style styles.jsonon thenaja-schematicserver andrenderCLIs.ValueErrorinstead of being silently skipped. An item can use"target", taking anythingshow_instance()/show_net()accept.Limits
--styleonly checks the file's format; an item naming a missing instance just doesn't match.Tests
tests/StyleStoreTest.cpp: parsing, matching, merging, the shapes and SVG output, and the diagnosis > style > trace precedence.python/tests/test_style.py: item validation, resolution to the driver (hierarchical pin, bus → per bit), re-push after each root, and an end-to-endnaja-schematic render --styleontests/data/fanout.vchecking the orange/blue/green/purple strokes and tinted sinks in the SVG.test_notebook.pynot run),reuse lintis clean, and native--export --stylewas checked by eye. The WASM build wasn't run.Note: the Debug-build renderer aborts on an ImGui font-atlas assert and fails 3 existing
test_render.pytests onmaintoo. That's unrelated to this PR; the Release renderer passes everything.