Home > Net >  change color of a text in php with echo
change color of a text in php with echo

Time:11-11

I use Sambroadcaster

change color of a text in php with echo

this is the code:

<span id="currently-playing-title"><?php echo $currentSong->artist_title;; ?></span><?php if ($currentSong->isRequested) echo "[Request]"; ?>

This is the text that i want to change the color [Request]

The next code is:

<?php if($comingSong->isRequested): ?>[Request]

In this line i want also change the color of the text [Request]

In the css there is no rule al the text colors are white

Any idea?

I try to find a solution in the css file but there is no rule herfore

CodePudding user response:

How about writing out some escape sequences?

echo "\033[01;31m [Request] \033[0m"";

this line only work in console

Another way is writing out some HTML tags and some CSS if you're outputting this to the browser?

echo '<span style="color:#AFA;text-align:center;"> [Request] </span>';

Remember last line code Won't work from console though, only through browser.

CodePudding user response:

Hi Hammad this one works great! Thanks!!!

  • Related