Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

RawUI colours

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 12-03-2006   #1 (permalink)
Thomas Lee
Guest


 

RawUI colours

I'm working an updated profile.ps1 and want to manage the colours
better.

I currently do this:

$host.ui.rawui.WindowTitle = "PowerShell Rocks!!!"
$host.ui.rawui.backgroundcolor="white"
$host.ui.rawui.foregroundcolor="darkblue"

However, I can't see the properties to enable me to change the colours
for the warning and error lines.

$Host.UI.WriteErrorLine("Foobar") for example writes red text on a black
background. Meanwhile $Host.UI.WriteWarningLine("Foobar") writes with
black bakground and yellow text.

How do I set the colours for warning and error lines?

Also, I note that the two functions differ in another way. If I run
them, I see:

PSH [D:\foo]: $HOST.UI.WRITEerrorline("Foobar")
Foobar
PSH [D:\foo]: $HOST.UI.WRITEwarningline("Foobar")
WARNING: Foobar

Note that the latter prepends "WARNING:" to the line. This behaviour is
inconsistent.

Seems to me that either WriteErrorLine to should add "ERROR" or
WriteWarningLine should not have the "WARNING:" at the front. If adding
"warning" or "error" is important, then provide a global Variable (e.g.
$WarningTextStart) to define it.

Thomas
--
Thomas Lee
doctordns@gmail.com
MVP - Admin Frameworks and Security

My System SpecsSystem Spec
Old 12-03-2006   #2 (permalink)
Rick
Guest


 

RE: RawUI colours

$host.PrivateData ErrorForegroundColor: Red ErrorBackgroundColor: Black
WarningForegroundColor: Yellow WarningBackgroundColor: Black
DebugForegroundColor: Yellow DebugBackgroundColor: Black
VerboseForegroundColor: Yellow VerboseBackgroundColor: Black
ProgressForegroundColor: Yellow ProgressBackgroundColor: DarkCyan




"Thomas Lee" wrote:

> I'm working an updated profile.ps1 and want to manage the colours
> better.
>
> I currently do this:
>
> $host.ui.rawui.WindowTitle = "PowerShell Rocks!!!"
> $host.ui.rawui.backgroundcolor="white"
> $host.ui.rawui.foregroundcolor="darkblue"
>
> However, I can't see the properties to enable me to change the colours
> for the warning and error lines.
>
> $Host.UI.WriteErrorLine("Foobar") for example writes red text on a black
> background. Meanwhile $Host.UI.WriteWarningLine("Foobar") writes with
> black bakground and yellow text.
>
> How do I set the colours for warning and error lines?
>
> Also, I note that the two functions differ in another way. If I run
> them, I see:
>
> PSH [D:\foo]: $HOST.UI.WRITEerrorline("Foobar")
> Foobar
> PSH [D:\foo]: $HOST.UI.WRITEwarningline("Foobar")
> WARNING: Foobar
>
> Note that the latter prepends "WARNING:" to the line. This behaviour is
> inconsistent.
>
> Seems to me that either WriteErrorLine to should add "ERROR" or
> WriteWarningLine should not have the "WARNING:" at the front. If adding
> "warning" or "error" is important, then provide a global Variable (e.g.
> $WarningTextStart) to define it.
>
> Thomas
> --
> Thomas Lee
> doctordns@gmail.com
> MVP - Admin Frameworks and Security
>

My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
GUI colours missing Ildhund Live Mail 9 05-30-2008 03:31 PM
Individual Colours not correctly supported Axel Dahmen Vista General 2 03-26-2008 01:15 PM
Is it possible to tag winmail messages with colours as you can with Thunderbird? Peter GODDARD Vista mail 0 09-27-2007 04:53 AM
Colours, date Catty Vista General 5 03-28-2007 12:28 PM
Demo: some toys with $Host.UI.RawUI and colors =?Utf-8?B?Um9tYW4gS3V6bWlu?= PowerShell 3 08-22-2006 12:50 AM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51