# Permanent coloring for text in p5.js

**URL:** <https://discourse.processing.org/t/permanent-coloring-for-text-in-p5-js/21271>\
**Category:** Libraries\
**Created:** [May 25, 2020, 8:57am UTC](https://discourse.processing.org/t/permanent-coloring-for-text-in-p5-js/21271 "2020-05-25T08:57:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johann75](https://avatars.discourse-cdn.com/v4/letter/j/c89c15/32.png) [@Johann75](https://discourse.processing.org/u/Johann75)\
**Post date:** [May 25, 2020, 8:57am UTC](https://discourse.processing.org/t/permanent-coloring-for-text-in-p5-js/21271/1 "2020-05-25T08:57:53Z")

</div>

Could anyone please suggest a way to not loop the text colour separately from my sound loop.

I was creating a timer which would highlight as red after the last 5 seconds. Also, I added a beep sound to remind the user(though it’s not perfect for publishing). If the number of seconds is more than 5, the text would be highlighted as green.but as a cold I noticed that the red colour is blinking each time a second passes. but I want it to be red permanently before the last 5 seconds. Could anyone suggest a way to fix this issue?[My Countdown Timer](https://editor.p5js.org/Johann_75/sketches/LMw0X99DK) Regards, Johann…

---

<div class="post-metadata">

**Author:** ![slow\_izzm](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/slow_izzm/32/5637_2.png) [@slow\_izzm](https://discourse.processing.org/u/slow_izzm)\
**Post date:** [May 25, 2020, 3:18pm UTC](https://discourse.processing.org/t/permanent-coloring-for-text-in-p5-js/21271/2 "2020-05-25T15:18:05Z")

</div>

When your`timeLeft <= 5` you can toggle a boolean. Check the state of that boolean and when true set the bg color to red.

```auto
if(timeleft-currentTime<=5){
    fill(200,0,0)
     has5SecLeft = true;
}

```

```auto
if (has5secleft) {
  bg = color(255,0,0);
} else {
  bg = color(0,255,0);
}

```
