Colors for text?

  • cat
    7th Jul 2016 Member 0 Permalink

    I noticed when looking through IntroText.h that before some of them, escape sequences were made for colors, what I got from it was

     

    \b = backspace (I assume)

     

    \bl or \l  is a light red

    \bo or \o is a yellow

    \br or \r is a darker red

     

    Is there anymore colors possible, or is this all we have to choose from?

  • SopaXorzTaker
    7th Jul 2016 Member 0 Permalink

    @cat (View Post)

    There are only these colors AFAIK, but you can add yours in Graphics.cpp!

  • LBPHacker
    7th Jul 2016 Developer 2 Permalink

    There sure are. \15 (that's a Lua escape, so this is actually \x0F) followed by 3 RGB bytes also works. So \15\255\255\1 sets the text color to rgb(255, 255, 1). I use \1 instead of \0 because \0 ends C-style strings and messes things up.

  • ChargedCreeper
    7th Jul 2016 Member 0 Permalink

    LBPHacker:

    C-style strings

     

    Why are those still used anyways?

    Edited 2 times by ChargedCreeper. Last: 7th Jul 2016
  • LBPHacker
    7th Jul 2016 Developer 0 Permalink

    Because there's no reason to use anything else. Most if not all functions in TPT only read those strings, not write them. They don't build strings. The ones that do are rare and, well, even those use C-style strings.

     

    Big nope, read below.

    Edited 2 times by LBPHacker. Last: 7th Jul 2016
  • Simon
    7th Jul 2016 Administrator 2 Permalink
    Check out drawtext in RasterDrawMethods.inl, you can see the character codes for various coloured stuff.
    \x0F (followed by R G and B values) will give you pretty much any colour you want, except pure black and \x0E will revert to the original colour. One that hasn't been mentioned is \x01, which will invert the current text colour.

    Also, plain C strings is just stuff that was never ported fully from C, and no UTF-8 because it's hard.
    Edited once by Simon. Last: 7th Jul 2016