Alarms according to events in msg.payload

Hello guys. I'm new here in the community. and I need help with a problem.

used a node Template I need to compare a text that comes in the msg.payload of a function node and if the content is Overload the text should change to overload, color red and keep blinking (fadeIn and fadeout) otherwise the text is OK in color green and static.

Can someone help me.

I do not know how to start

There’s an example of how to colour text based on value in the info panel of the template node.

Once you’ve done that, you would need to look at CSS for how to do the fades.

One thing to do mention is that changing text from red to green can’t be differentiated by 8% of people who are red-green colour blind

This is the code I tried to use but without success.

<script>
(function(scope) {
    // watch msg object from Node-RED
    scope.$watch('msg', function(msg) {
        // new message received
        var blinkStatus = msg.payload;
        
         var Blinker = {
                interval: null,
                 start: function() {
                     if (this.interval) return;
                        this.interval = setInterval(function() {       
                             $('#blink').toggle();
                            }, 250);
                    },
    stop: function() {
        clearInterval(this.interval);
        $('#blink').show();
        this.interval = null;
             }
}

        setInterval(function() {
    if (blinkStatus ==="Fator de Serviço") {
        Blinker.start();
    }
    else {
        Blinker.stop();
    }
}, 250);     
    })
})(scope);
</script>
<div ng-bind-html="msg.payload" id="blink">{{payload}}</div>