Automatically graph color


I’m new with Obsidian, not sure to post on the good section, sorry if so…

I’m trying to keep de same colors settings by défault for all my graphs

This for exemple the default grap vue :

But if i open a folder, and then i choose "More options/open the graphic vue around the current file " :

My colors settings are not keeped :confused:

if someone had an idea for me to automate this it would be great, and define default colors according to my groups of notes (these will be the same groups used by all my graphs).
Thanks in advance to whoever has an idea :slight_smile:

You’re in luck - we were talking about how to do exactly that yesterday:

Here’s a guide for saving and setting different sets of groups in for the Graph View:

How to save and load Graph View groups

Hi Alan,

thank you very much for this quick feedback

this actually looks like a great lead to me !

I tried to create a note with your first code with and without quotes but I did not understand how to execute it and recover the values:confused:
i tried too but it’s the same.

otherwise I observe that when I open a note, and modify the colors, if I pass on the other notes then, the colors are kept but nothing is saved if I close and restart obsidian

You’ll need the Dataview plugin installed first, then just paste in the code into a normal note - not into the Graph query. You shouldn’t have the ```` quotes around it.

Ok ty it’s cool, now i’m moving forward !! :slight_smile:

for those who are interested, my version of Obsidian is 0.15.9 (windows),

I just installed Dataview pluggin v0.5.43, then enabled it.

A create a new note, and paste :


then i remove the first and last quote lines :

if the code isn’t executed i use ctrl +E

Then i get

and enable JS queries on the pluggin’ options :

now i get this :

Perfect! So now just use that information along with the script from the Updating the groups section in the guide, and you can change them however and as often as you wish.

Sorry I’m at work :confused:
Yes it’s a good start…

I’m trying to use your second script ( start and end with my color code in) as this :

But for now, i tried to place the note with these code on my different group then execute… but no change ;

I was able to verify that the RGB codes are indeed linked to my default generated graphic, because this code changes when I change a color manually.
However I can’t yet apply it to groups of notes.

When i paste this code on a note witch already exist, then ctrl + E, i see the refresh on the right graph pane , but the colors doesn’t change.

  1. Close the graph
  2. Open a new note
  3. Paste my 2nd script in
  4. Press Enter so that the script disappears and you’re looking at a blank note
  5. Go to the Graph page

Do you now have just the two groups from my script?

Ty :slight_smile:
I followed these points and the script disappears fine, then I have only one point:

In both screenshots you still have the graph window open.

At my end everything works fine and one difference is that I don’t have a graph window open. So that was the purpose of step 1, to remove that from the equation.

I begin by close all graphs, then i past your code, and it disapears…

Finally i open the graph using the option “open the graphic vue around the current file”

(ssry i’am in french )

I haven’t managed to apply the color scheme yet, but, by going through the ‘filter’ function from the main graphic view, I manage to keep the color, so this remains a secondary solution.

I’m also looking to have links dependent on others like this:


Do you know if it’s possible?

I’am using my notes as groups, services and other and i need to show dependencies vector.

as this is another topic, I created a new post here :