Skip to content

Commit

Permalink
colorize ports by port_type
Browse files Browse the repository at this point in the history
  • Loading branch information
tvt173 committed Nov 29, 2022
1 parent 51c1530 commit 65b65f6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions gdsfactory/circuitviz.py
Expand Up @@ -20,9 +20,12 @@
"dss": {},
}


# netlist = create_pic()
# # netlist.move_instance('i3', 150, 200)
COLORS_BY_PORT_TYPE = {
"optical": "#0000ff",
"electrical": "#00ff00",
"placement": "white",
None: "gray", # default
}


def save_netlist(netlist, filename):
Expand Down Expand Up @@ -113,7 +116,8 @@ def _get_sources(objs):
src["y"].append(obj.y)
# src["width"].append(obj.w)
# src["height"].append(obj.h)
src["fill_color"].append("green")
color = COLORS_BY_PORT_TYPE.get(obj.port_type, COLORS_BY_PORT_TYPE[None])
src["fill_color"].append(color)
src["fill_alpha"].append(0.5)
return srcs

Expand Down

0 comments on commit 65b65f6

Please sign in to comment.