PowerShell-Docs icon indicating copy to clipboard operation
PowerShell-Docs copied to clipboard

Make prompt colors configurable

Open dkaszews opened this issue 1 year ago • 0 comments

Prerequisites

  • [X] Existing Issue: Search the existing issues for this repository. If there is an issue that fits your needs do not file a new one. Subscribe, react, or comment on that issue instead.
  • [X] Descriptive Title: Write the title for this issue as a short synopsis. If possible, provide context. For example, "Document new Get-Foo cmdlet" instead of "New cmdlet."

Summary

https://github.com/PowerShell/PowerShell/pull/18003 introduces new properties to $PSStyle that control how -Confirm prompt is rendered:

$PSStyle.Prompt.Caption
$PSStyle.Prompt.Message
$PSStyle.Prompt.Help
$PSStyle.Prompt.ChoiceDefault
$PSStyle.Prompt.ChoiceOther
$PSStyle.Prompt.ChoiceHelp

Details

The documentation should explain which property controls which part of the confirm prompt. In the example below:

$PSStyle.Prompt.Caption = $PSStyle.Background.Red  # First line
$PSStyle.Prompt.Message = $PSStyle.Foreground.BrightBlack  # Other lines
$PSStyle.Prompt.Help = $PSStyle.Foreground.Purple  # "default is"
$PSStyle.Prompt.ChoiceDefault = $PSStyle.Foreground.Purple  # First choice
$PSStyle.Prompt.ChoiceOther = $PSStyle.Foreground.Blue  # Other choices
$PSStyle.Prompt.ChoiceHelp = $PSStyle.Foreground.Green  # Choice "[?] Help"

image

An image with rectangles and arrows deliminating each section may be clearer than trying to match colors.

Articles

  • reference/7.4/Microsoft.PowerShell.Core/About/about_CommonParameters.md, section -Confirm

Related Source Pull Requests

  • https://github.com/PowerShell/PowerShell/pull/18003

Related Source Issues

  • https://github.com/PowerShell/PowerShell/issues/17961

dkaszews avatar Aug 16 '23 20:08 dkaszews