Suppose i've a php file and i want to change text-colour of my output for a console based application…
<?php
$prompt = "What Is Your Name: ";
echo $prompt;
$answer = "You Entered: " . rtrim( fgets( STDIN ));
echo $answer;
?>
I want to change text-colour of $answer
.
Is it possible? If yes, how can I do this?
Best Answer
Now you can use 24-bit true color in terminal in Ubuntu 16.04
^[38;2;<red>;<green>;<blue>m
^[48;2;<red>;<green>;<blue>m
<red> <green> <blue>
range from 0 to 255 inclusive.^[0m
returns output to default.See RGB Color Codes Chart
Demonstration of 24-bit true color in a script:
Here is the modified script to produce colored output.
Sample Output of the above script: