Style your console 'Print's

I thought it would be fun to put color to some messages that was printed to stdout in Console Applications.
If you want it, go grab it.
https://app.box.com/s/jnt4qc28wa1g17x2kv62gjwck7k330t4

Features:
Coloring of text
Coloring of background of text
Blink text.
Style Bold/Underline/Regular
Can be used inline to style part of text.

It’s used just like the normal Print() but with some extra parameters.

Print ( "This is a message", ColorConsole.FG_White, ColorConsole.BG_Blue, True, ColorConsole.FS_Bold, False )

This would show the text “This is a message” in bold white text on a blue background…blinking :slight_smile:

Someone might find this handy…it’s only been tested using Xojo 2013r3.3 on El Capitan 10.11.2.

The variables you pass are strikingly similar to those from https://forum.xojo.com/conversation/post/235565
You locked yours, so I can’t quite compare.
Any relation to that code?

When I was fiddling around with getting styled output to work for that thread, I had created my own version as an object. My design was so that you only needed to pass styles you intended to change. It required more lines of code to use, but it was easier to read imo.

I wasn’t in the mood to share it for that thread because the number of people just copying and pasting code without grasping how it works lately is starting to bother me. However in light of this thread, and my alternate approach, I feel like I should share it and see what people think.

Direct Link 16KB

Example:

// Full line example
dim myTxt as new StyledPrint
myTxt.ForeColor = StyledPrint.Red
myTxt.Bold = true
myTxt.Blink = true
myTxt.txt = "Test string that is going to be red, bold, and blinking."
  
myTxt.print
// Inline example
dim inlineTxt as new StyledPrint
inlineTxt.ForeColor = StyledPrint.Green
inlineTxt.Underline = true
inlineTxt.txt = "inline"
  
dim greenText as String = inlineTxt.gen
  
print("It's also easy to use " + greenText + " for simply highlighting words.")

[quote=236409:@Tim Parnell]The variables you pass are strikingly similar to those from https://forum.xojo.com/conversation/post/235565
You locked yours, so I can’t quite compare.
Any relation to that code?[/quote]
Nope, had not even seen that thread until now :slight_smile:

Thanks for sharing Tim!

As that one is already on Github and it(and yours) seems to work very similar, I’ll just pull this one…no point in having many similar modules around :slight_smile:

Thanks for pointing me to it!

@Tim Parnell I do like your approach using an object. It’s a bit more lines instead of just one, but its easy to read :slight_smile:
Kudos!