In case you want to test CSS variable in a ui_template method, here's a flow that shows the basics:
[
{
"id": "eb204ee6.62865",
"type": "ui_template",
"z": "65935088.e7e47",
"group": "5625d033.1d56f",
"name": "Change theme color",
"order": 0,
"width": 0,
"height": 0,
"format": "<style>\nmd-toolbar#toolbar{\n background-color: var(--main-color);\n}\n\nbody.nr-dashboard-theme md-content {\n color: var(--main-color);\n}\nbody.nr-dashboard-theme md-sidenav {\n color: var(--main-color);\n}\n.nr-dashboard-theme .nr-dashboard-button .md-button {\n background-color: var(--main-color);\n}\n.nr-dashboard-theme .nr-dashboard-template .md-button{\n background-color: var(--main-color);\n}\n.nr-dashboard-theme .nr-dashboard-template .md-button:disabled {\n color: grey;\n}\n.nr-dashboard-theme .nr-dashboard-slider .md-thumb:after {\n background-color: var(--main-color);\n border-color: var(--main-color);\n}\n.nr-dashboard-theme .nr-dashboard-slider .md-track-fill {\n background-color: var(--main-color);\n}\n.nr-dashboard-theme .nr-dashboard-template ::-webkit-scrollbar {\n background-color: #666666;\n}\n.nr-dashboard-theme .nr-dashboard-template ::-webkit-scrollbar-thumb {\n background-color: var(--main-color);\n}\n</style>\n\n<script>\n(function($scope) {\n \n$scope.$watch('msg.payload', function() {\n console.log($scope.msg.payload);\n var html = document.getElementsByTagName('html')[0];\n html.style.setProperty(\"--main-color\", $scope.msg.payload);\n});\n})(scope);\n</script>",
"storeOutMessages": true,
"fwdInMessages": true,
"templateScope": "local",
"x": 520,
"y": 760,
"wires": [
[]
]
},
{
"id": "4ac7255.934ecdc",
"type": "inject",
"z": "65935088.e7e47",
"name": "",
"topic": "",
"payload": "red",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 290,
"y": 720,
"wires": [
[
"eb204ee6.62865"
]
]
},
{
"id": "76a5b5ff.26754c",
"type": "inject",
"z": "65935088.e7e47",
"name": "",
"topic": "",
"payload": "blue",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 290,
"y": 760,
"wires": [
[
"eb204ee6.62865"
]
]
},
{
"id": "5625d033.1d56f",
"type": "ui_group",
"z": "",
"name": "test",
"tab": "9a95bc09.40d37",
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "9a95bc09.40d37",
"type": "ui_tab",
"z": "",
"name": "test",
"icon": "dashboard"
}
]