Skip to main content

Ampligy Color Change Emergency Notification

<!-- Load jQuery (only if not already loaded) -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

<!-- Your custom color logic -->
<script>
setTimeout(function () {
  var background = $('.traction-emergency-notification, .legacy-notification.notice, .legacy-notification.emergency');
  var extbackground = $('.traction-emergency-notification h2, .legacy-notification.notice h2, .legacy-notification.emergency h2');
  var parabackground = $('.traction-emergency-notification p, .legacy-notification.notice p, .legacy-notification.emergency p');
  var text = $('.inner h2, .legacy-notification.notice h2, .legacy-notification.emergency h2').text().toLowerCase();

  if (text.includes('low')) {
    setBackground('#006600');
  } else if (text.includes('moderate')) {
    setBackground('blue');
  } else if (text.includes('very high')) {
    setBackground('orange', 'black');
  } else if (text.includes('high')) {
    setBackground('yellow', 'black');
  } else if (text.includes('extreme')) {
    setBackground('#B30000');
  }

  function setBackground(bgColor, textColor) {
    background.css('background', bgColor);

    if (textColor) {
      background.css('color', textColor);
      extbackground.css('color', textColor);
      parabackground.css('color', textColor);
    }
  }
}, 200); // 200ms delay should be enough — adjust if needed
</script>