Gimme Gimme Color

In PrimalScript 8.1.182, we added an option to the current packager engines allowing you to adjust the colors of specific output categories. This change will also be included in a future PowerShell Studio release.

You may have seen the properties below in a PowerShell console:


These are properties on the $host object of the console. Rather than overriding this object in packaged scripts, we added the same properties to the $SAPIENHost object, which allows you to use one set of colors if you are testing in a console, and another set of colors once you have packaged your script.

If you test in a console that is typically black—but package as a Light Mode Windows app—this makes a difference.


The result for a packaged console app then look like this:


Equally, if you package this as a Dark Mode Windows app, you get the same result:


The eagle-eyed amongst you may also have noticed that the caption and frame of this Dark Mode app are now, well, dark.

With this build, the host ‘SAPIEN PowerShell V5 Host Dark Mode (Windows Application) x64’, and the equivalent versions for PowerShell 7.2.11 and 7.3.4 set the proper Windows attributes when running under Windows 11.

All current engines for Windows PowerShell, PowerShell 7.2.11, and PowerShell 7.3.4 (or later) have the color properties on the $SAPIENHost object. They do not have any affect when packaged for a service or a Windows Forms app, but your code will not generate any errors if you have color settings for test code.


As always, please comment below or use our support forum if you have any questions or suggestions.