4

I am currently playing with the PSReadLine module options in PowerShell. In particular I am setting up a custom color theme. I have been able to set most of the colors I require using the following syntax as an example: Set-PSReadLineOption -TokenKind Variable -ForegroundColor DarkYellow

However when I use the MenuComplete function of the PSReadLine module by pressing Ctrl+Spacebar the suggestions are highlighted in DarkGreen and I cannot seem to find a way to change these colors.

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
rjkowalewski
  • 341
  • 5
  • 19
  • Which PoSh/PSReadline version? Here the command is `Set-PSReadLineOption -TokenKind Variable -ForegroundColor DarkYellow` –  Jun 26 '17 at 13:10
  • 1
    Sorry @LotPings that was just a typo on my part. I've corrected it now. PowerShell is v5, PSReadLine v1.1 which is shipped with Windows 10. – rjkowalewski Jun 26 '17 at 13:27
  • Win10 Build 15063 has PowerShell v5.1 PSReadLine v1.2 PowerShell v6.0.0 Beta3 comes also with PSReadLine v1.2 –  Jun 26 '17 at 13:43
  • I am on Windows 10 1511 (OS Build 10586.962) which has PowerShell v5.0 and PSReadLine v1.1. – rjkowalewski Jun 26 '17 at 13:45
  • I'm not sure the versions are an issue. I am just unable to find a way to change the color of the `MenuComplete` function output. – rjkowalewski Jun 26 '17 at 16:42
  • Well my question regarding the version was because of the naming difference. I know PSReadLine was introduced with PS v5. –  Jun 26 '17 at 16:45

1 Answers1

2

I don't see this option in the old color settings, but as of 6.1.0, you can change the color of Selection like this:

$colors = @{
   "Selection" = "$([char]0x1b)[38;2;0;0;0;48;2;178;255;102m"
}

Set-PSReadLineOption -Colors $colors

enter image description here

Tatiana Racheva
  • 1,289
  • 1
  • 13
  • 31
  • Do you know how to make these settings persist? https://superuser.com/questions/1521541/set-psreadline-colors-and-then-persist-them – Andrew Shepherd Jan 30 '20 at 23:14
  • Can you explain the format of the color? I can't find anything. – Holt Jul 18 '22 at 07:56
  • @Holt, it's referenced in the documentation on the -Colors parameter that I linked. It is this: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors – Tatiana Racheva Aug 28 '22 at 01:55