-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add New-VtConsoleSequence, to provide embeddable strings and not require Pansies in distributable code #19
Comments
If we can get an acceptable req, I would PR it. I'd love to contribute. |
All you have to do is run the output through (Text ${fg:Aquamarine}Hello) -replace "`e",'`e'
[rgbColor]::Background("ea0016") -replace "`e",'`e'
$fg:Tomato -replace "$([char]27)",'$([char]27)' Or even: (Get-Gradient Tomato Aquamarine -Length 10 | % ToVtEscapeSequence $false) -replace "$([char]27)",'$([char]27)' |
Originally, none of that seemed like a good idea to me. When I started this, there were a lot of places (particularly Windows) where only a subset of colors were supported (e.g. 16 colors, or 256 colors), so one of the best features of PANSIES was the ability to set the mode to whatever your terminal supports. Nowadays that doesn't seem worth worrying about as much, and in many modules, I'd be willing to just hard-code RGB color sequences... I think it would definitely be interesting to write something that could be run on PowerShell files (.ps1 and .psm1 and .ps1xml format files) at "build" time to use the AST parser and replace references to the drives (i.e. In fact, with that in mind, I wouldn't mind adding a PSProvider drive for |
Just to update: I never did the drive provider for those others, but I did add them as entities that are handled by Pansies' Write-Host "Hello&smilingfacewithtear;" I am leaving this open because I do still want to implement something to replace all those |
Use case: my team has ~200 powershell modules deployed to an enterprise nuget source. Our dependency trees are a little cumbersome. We don't want to add any dependencies if we can avoid it.
We do use ANSI sequences, some of which I have generated with Pansies - ♥ - but I am currently doing some awkward manipulation to create strings which I can embed in our modules.
I would like to use a function
New-VtConsoleSequence
in development, to create those strings.It would have a
Reset
switch in one parameterset, to output an ANSI reset; the other parameterset would accept any valid input to the ctor for RgbColor, e.g.ForestGreen1
,ea0016
.I would also like a
EscapeAsExpression
switch, which would behave as follows:Then my module functions will have code like this:
The text was updated successfully, but these errors were encountered: