call-graph icon indicating copy to clipboard operation
call-graph copied to clipboard

Add SVG restyle to match vscode theme

Open jotavemonte opened this issue 1 year ago • 9 comments

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 avatar May 27 '24 18:05 jotavemonte

@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.

jotavemonte avatar May 27 '24 19:05 jotavemonte

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.

beicause avatar May 28 '24 06:05 beicause

@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.

jotavemonte avatar May 28 '24 08:05 jotavemonte

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

beicause avatar May 29 '24 03:05 beicause

@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.

jotavemonte avatar May 29 '24 18:05 jotavemonte

@beicause Please revisit this thread

jotavemonte avatar Nov 18 '24 13:11 jotavemonte

I suggest using graphviz attribute (color, bgcolor or fillcolor, etc) to style graphs. Refer to https://graphviz.org/doc/info/attrs.html

beicause avatar Nov 19 '24 08:11 beicause

@beicause I changed the approach compared to the last version. Now it injects the color in the .dot generation and it replaces it once we have access to the theme RGB in the html step. Please check if it makes sense. Thank you

jotavemonte avatar Nov 24 '24 00:11 jotavemonte

@beicause Hey. I updated and tested the extension. Now we should be able to support the colors directly in the dot file.

jotavemonte avatar Jan 25 '25 22:01 jotavemonte

@beicause can you check it out please?

jotavemonte avatar Feb 26 '25 12:02 jotavemonte

@beicause Hey. Can you please check this out? Thanks!

jotavemonte avatar Apr 14 '25 07:04 jotavemonte