Injecting payload value into ui-template

hello,
I am looking for a solution to dynamically change the background color of the dashboard v1.0.
I searched but I'm not very experienced in pure code.
my need :
I have two payload variables:
msg.colorbas
msg.colorbas
that I want to use as a variable in a ui-template.
the code works well with constants.
Thank you for your help :wink:

body {
    background: -webkit-linear-gradient(
    55deg,
    {{msg.colorbas}} 0%,         /*#181718 */ 
    {{msg.colorhaut}} 100%       /*#92539B */
    );
    -webkit-touch-callout: none !important;
}

Hello @stef68600 and welcome to the forum.

I think you basically just need to wrap the code you posted above in <style> tags.

I left out the -webkit-touch-callout: none !important bit because I have no idea what it's for :smiley:

<style>
body {
    background: -webkit-linear-gradient(
    55deg,
    {{msg.colorbas}} 0%,         /*#181718 */ 
    {{msg.colorhaut}} 100%       /*#92539B */
    );
}
</style>

image

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.