beicause / call-graph

Generate call graph for vscode in svg or graphviz dot.
Apache License 2.0
73 stars 17 forks source link

Add SVG restyle to match vscode theme #26

Open jotavemonte opened 1 month ago

jotavemonte commented 1 month ago

Summary

Intercept the SVG generated by graphviz and change the colors according to the vscode current theme.

Address the #24 "Make graph nicer." milestone

How it works

Explore the graph using a BFF algorithm, for each node, change the children's values according to their classes.

Evidences

image image image

jotavemonte commented 1 month ago

@beicause I used the selection background color for the nodes and it isn't ideal in every theme, but in most of them it looks good.

beicause commented 1 month ago

I think we'd better to theme the graphviz( .dot ) file directly. Changing the style of svg doesn't affect the .dot file we save.

jotavemonte commented 1 month ago

@beicause Sure! Should we have this as a temporary solution and then I can open an issue to migrate the solution to the other end of the file generation? With this strategy, we would have themes for the graphs right away.

beicause commented 1 month ago

I have no reason to merge this PR now which adds unnecessary complexity if there is a better approach. Let's improve it firstly.

jotavemonte commented 1 month ago

@beicause I was investigating the options and AFAIK that the color palette is only available at the web view step - we could use some placeholders and interpolate them, but this would add some complexity and processing to the rendering step too.

Do you have an idea on how to approach this? Thank you.

Edit: My previous assumptions were incorrect.