0

Possible Duplicate:
how to have multiple colors in a batch file?
Colorizing Windows command line output from PHP

Let me just make this very clear: I am on WINDOWS, so \033[0;35mText WILL NOT WORK.

Sorry to have to emphasize like that, but every possible duplicate I have seen has people saying to use the above code regardless of what OS the question is about.

Now, I know it's possible without too much trouble - ffmpeg does exactly the kind of thing I want to do:
Example
(source: adamhaskell.net)

So how hard can it be?

Community
  • 1
  • 1
Niet the Dark Absol
  • 301,028
  • 70
  • 427
  • 540

1 Answers1

0

Use SetConsoleTextAttribute to set the text colour.

Joey
  • 316,376
  • 76
  • 642
  • 652
  • Is this available for PHP-CLI? – Niet the Dark Absol Nov 13 '12 at 16:18
  • I'm not familiar with PHP's FFI, but it's just a normal Windows API function. You *could* have been a little more specific in your question, though. E.g. mentioning that it's about PHP would have been *great*. There seems to be [a PEAR package](http://pear.php.net/package/Console_Color) doing something like that, though. – Joey Nov 13 '12 at 16:22
  • Sorry for not mentioning it. I guess I got caught up in making sure it was clear that I'm working on Windows. Anyway, that PEAR package seems to generate Linux ANSI codes, so that won't work... And it seems like all Windows API extensions have been discontinued since 2004... – Niet the Dark Absol Nov 13 '12 at 16:36