Click here to Skip to main content
13,766,015 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


21 bookmarked
Posted 26 Jul 2013
Licenced GPL3

xConsole Project

, 23 May 2014
Rate this:
Please Sign up or sign in to vote.
Coloring the window console


Hi, it`s my project called xConsole, in few words this DLL gives you the ability to color, animate comfortably the console window, parse input, modify fonts and more.

It has been written in C# .NET 4.5.

Using the Library

  1. Add Reference > xConsole.dll
  2. using xConsoleProject;

Example of coloring:

xConsole.WriteLine("^yLorem ipsum dolor sit amet^r, consectetur adipiscing elit. " + 
     "^.Nullam porttitor lectus justo, vel viverra est pellentesque non.^!"); 

^y Set Yellow Color
^r Set Red Color
^. Set a Random Color (different from the background)
^! Restore default font color

<code>*y *r *m Sets Colors
*. Random background Color
*! Restore default bg.

xConsole.CoolWriteLine("I like write like a boss.");
// OR

xConsole.CoolWriting = true;
xConsole.WriteLine("^600I like write ^F00like a boss"); // Or 6 digits (^FF00FF)..
xConsole.WriteLine("Yes ^ycolors is ^msupported^!");
xConsole.CoolWriting = false;

[Updated] List of Colors

Using enum (now same of Microsoft):

public enum ConsoleColor
    Black = 0,
    DarkBlue = 1,
    DarkGreen = 2,
    DarkCyan = 3,
    DarkRed = 4,
    DarkMagenta = 5,
    DarkYellow = 6,
    Gray = 7,
    DarkGray = 8,
    Blue = 9,
    Green = 10,
    Cyan = 11,
    Red = 12,
    Magenta = 13,
    Yellow = 14,
    White = 15,

HEX to ConsoleColor (the HEX code must be uppercase):

xConsole.WriteLine("^600I like to paint ^F00like a boss");

With letters:

xConsole.WriteLine("^yI like to paint ^rlike a boss");
w:    White
z:    Black
y:    Yellow
g:    Green
r:    Red
b:    Blue
c:    Cyan
m:    Magenta

Read Line

var args = xConsole.ReadLine();

Will give back a List<string> (never null) contains the arguments parsed, entered by the user, Like:

Hi "this is a string" then 9999

[0] = Hi
[1] = This is a string
[2] = then
[3] = 9999

An empty input: (list size 1, value empty string)

[0] =

So you need to check if its string is Empty. Yeah, i don't like null values..


This class allows you to create an animated spinner.

var spinner = new xConsole.Spinner();
new Thread(delegate()
    //Spin until user interruption


xConsole.Write("^2STATUS: ^7"); 
// Waiting the thread is done.
while (spinner.Turn());

Move window

SetWindowPos(int x, int y); 


I also added console helper.


Set font, list font, change icon...

Next Update

  • Sound management?


  • Now check updates every 30 days (only in debug)
  • No more create registry key in release
  • Removed Stats sending
  • Removed Settings
  • Fixed ClearColorsAtEnd function (restoring previous colors)
  • Added Test program (Both sources)
  • Released source code (v 0.3)
  • It's not a spywere see above
  • [NEW] Optional separate-thread writer (default ON)
  • [NEW] Random color always != from background
  • [NEW] Background colors using * tag
  • [NEW] Update Checking (only in debug)
  • [NEW] New Functions like WaitQueue (main program wait until the queue is resolved)
  • [UPDATED] Fixed a bug in the spinning
  • [UPDATED] Spinning now supports colors
  • [???] A lot of emoji in the code
  • [Source Code] will be available, I need to make it beautiful, btw you can reflect it
  • [It would] be nice to do a port to C++
  • Improved method of color selection
    Now you can use ^RBG colors (3bytes), like ^F00 = red
    ^00F = Blue, ^0F0 = green, ^600 = darkred ...etc... (RBG colors is rounded to ConsoleColors)
    and ^y = yellow
    ^r = red
    ^m = magenta .. etc
  • Random color moved to ^.


This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


About the Author

Italy Italy
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralMy vote of 5 Pin
Volynsky Alex23-May-14 13:18
professionalVolynsky Alex23-May-14 13:18 
GeneralMy vote of 1 Pin
KenL4cp20-Jan-14 11:03
memberKenL4cp20-Jan-14 11:03 
Question5 Pin
Assil20-Jan-14 6:15
professionalAssil20-Jan-14 6:15 
GeneralMy vote of 1 Pin
Spirch20-Jan-14 6:10
memberSpirch20-Jan-14 6:10 
GeneralRe: My vote of 1 Pin
TheTrigger21-Jan-14 7:15
memberTheTrigger21-Jan-14 7:15 
Bugwarning this code send information to third party Pin
Spirch20-Jan-14 6:05
memberSpirch20-Jan-14 6:05 
GeneralRe: warning this code send information to third party Pin
KenL4cp20-Jan-14 10:28
memberKenL4cp20-Jan-14 10:28 
GeneralRe: warning this code send information to third party - Updated and Fixed Pin
DaveyM6921-Jan-14 2:37
mentorDaveyM6921-Jan-14 2:37 
QuestionCould you please add a version of this code here on CodeProject.? Pin
Pete O'Hanlon29-Jul-13 23:21
protectorPete O'Hanlon29-Jul-13 23:21 
GeneralMy vote of 4 Pin
Assil27-Jul-13 12:33
professionalAssil27-Jul-13 12:33 
GeneralMy vote of 4 Pin
Carlos190726-Jul-13 7:36
professionalCarlos190726-Jul-13 7:36 
Great "Old School" Smile | :)
I think the color selection must be more polished...
GeneralRe: My vote of 4 Pin
TheTrigger26-Jul-13 22:43
memberTheTrigger26-Jul-13 22:43 
SuggestionRe: My vote of 4 Pin
Carlos19073-Aug-13 6:27
professionalCarlos19073-Aug-13 6:27 
GeneralMy vote of 4 Pin
fredatcodeproject26-Jul-13 5:56
professionalfredatcodeproject26-Jul-13 5:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web01-2016 | 2.8.181114.1 | Last Updated 23 May 2014
Article Copyright 2013 by TheTrigger
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid