Part of Obsidian guides
Published with Obsidian Share
Put this code into a note to retrieve your current group settings:
```dataviewjs
const settings = await app.internalPlugins.plugins.graph.loadData()
dv.paragraph('```json\n' + JSON.stringify(settings.colorGroups, null, 2) + '\n```')
```
It will show you something like this:
[
{
"query": "tag:#some-tag",
"color": {
"a": 1,
"rgb": 16249602
}
},
{
"query": "tag:#another-tag",
"color": {
"a": 1,
"rgb": 2969559
}
}
]
Take a note of the query
and rgb
values.
Take the code below and put it into a note. It will update all your graph groups to be the two groups specified, #this-is-the-new-query
and #another-new-query
.
```dataviewjs
const graph = app.internalPlugins.plugins.graph
const settings = await graph.loadData()
settings.colorGroups = [
{
"query": "#this-is-the-new-query",
"color": {
"a": 1,
"rgb": 16185856
}
},
{
"query": "#another-new-query",
"color": {
"a": 1,
"rgb": 16187906
}
}
]
await graph.saveData(settings)
await graph.disable()
await graph.enable()
```
If you follow the structure inside the settings.colorGroups
section, you can update the groups as you wish.
To change between different groups profiles, you just need to launch the Javascript code above. You could: