Currently I am tinkering with python to change the json flow file.
From what I could tell (noob) correct me if I am wrong the flow.json file doesnt have identifiers or its all contained under the same key.
Opening the file in notepad json viewer does generate object keys but isn't useful as every flow.json differs.
So I am this far to extract the part I need to change with the following
Note in order to get this python script working the python module json needs to be installed.
pip install simplejson
''' JavaScript Object Notation '''
import json
with open('flows.json') as f:
data = json.load(f)
#print (data)
for i in data:
if i['type'] == 'ui_base':
#print(i['theme'])
with open('new_flows.json', 'w') as f:
json.dump(i, f, indent=2)
break
Basically it loads the contains json of the file transforms it the python object then it loops through until it finds the type which equals ui_base then dumps/transforms the python object into json file new_flows.json
Please note that it is dangerous to take your live flow.json file I just copied it to a other directory.
file:new_flow.json
{
"theme": {
"name": "theme-dark",
"angularTheme": {
"warn": "red",
"accents": "blue",
"primary": "indigo",
"background": "grey"
},
"lightTheme": {
"default": "#0094CE",
"baseColor": "#0094CE",
"edited": true,
"reset": false,
"baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"
},
"customTheme": {
"default": "#4B7930",
"baseColor": "#4B7930",
"name": "Untitled Theme 1",
"baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"
},
"themeState": {
"page-titlebar-backgroundColor": {
"edited": false,
"value": "#097479"
},
"page-backgroundColor": {
"edited": false,
"value": "#111111"
},
"widget-backgroundColor": {
"edited": false,
"value": "#097479"
},
"page-sidebar-backgroundColor": {
"edited": false,
"value": "#000000"
},
"widget-textColor": {
"edited": false,
"value": "#eeeeee"
},
"group-backgroundColor": {
"edited": false,
"value": "#333333"
},
"base-font": {
"value": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"
},
"group-textColor": {
"edited": false,
"value": "#0eb8c0"
},
"widget-borderColor": {
"edited": false,
"value": "#333333"
},
"group-borderColor": {
"edited": false,
"value": "#555555"
},
"base-color": {
"default": "#097479",
"edited": false,
"value": "#097479"
}
},
"darkTheme": {
"default": "#097479",
"baseColor": "#097479",
"edited": true,
"reset": false,
"baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"
}
},
"type": "ui_base",
"id": "d66d61f0.03bbc",
"site": {
"lockMenu": "false",
"name": "Node-RED Dashboard",
"dateFormat": "DD/MM/YYYY",
"sizes": {
"sy": 48,
"sx": 48,
"px": 0,
"py": 0,
"gy": 6,
"gx": 6,
"cy": 6,
"cx": 6
},
"hideToolbar": "false",
"allowTempTheme": "true",
"allowSwipe": "true"
}
}
Now I just need to figure out a method to change the data and inject it back...