omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Formatted Colored Text Output

    Pythonista
    formatted text color codes
    3
    3
    3340
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • richiwalt
      richiwalt last edited by

      Why is formatted colored text out considered invalid syntax ?

      print "%d = \033[91m%d\033[0m x %d \033[92m(or %d)\033[0m with a remainder of: %d" % (num1, m, num2, num2*m, r)
      

      Is there something I’m overlooking or is this not supported ?

      1 Reply Last reply Reply Quote 0
      • enceladus
        enceladus last edited by

        Not supported. See the discussion
        https://forum.omz-software.com/topic/4131/colorama-see-characters-in-color

        1 Reply Last reply Reply Quote 0
        • dgelessus
          dgelessus last edited by

          @richiwalt If you're getting a Python SyntaxError when running that code, it's because the code is for Python 2, but Pythonista's default is Python 3. (In Python 3 you need to put parentheses around the arguments for print, like with any other function. In Python 2, print is special and doesn't require parentheses.)

          However in any case Pythonista doesn't support changing the text color using escape sequences - if you try to use them, you'll see the escape sequences printed out with no change in color. If you want to change the console text color in Pythonista, you can use the set_color function from the console module.

          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          Powered by NodeBB Forums | Contributors