Skip to content

Enforce Consistency / Readability of Colors #127

Description

@vexx32

Describe "Functionality"

Console colors can be reconfigured arbitrarily, causing our set colors for Show-MeditationPrompt to become a bit unreadable. We could handle this better.

Context "Private or Public? What are the use cases? Parameters? Options?"

Private module handler command, possibly tied in with Write-ConsoleLine

Context "Additional Information"

from @SeeminglyScience's reply:

@vexx32 If PSReadLine is loaded you can pull from it's settings to determine what colors to use.

$psrlModule = Get-Module PSReadLine
if (-not $psrlModule) {
    return
}

$options = Get-PSReadLineOption
if ($psrlModule.Version.Major -ge 2) {
    # Handle as ANSI escape
    return '{1}Colored like a number{0} {2}Colored like a keyword{0}' -f (
        "$([char]27)[0m", # Reset color ANSI escape
        $options.NumberColor,
        $options.KeywordColor)
} else {
    # Handle like ConsoleColor
}

/cc @thomasrayner @SeeminglyScience

Metadata

Metadata

Assignees

No one assigned

    Labels

    Category-ModulePertaining to the module's functionality itself.Issue-Enhancement 🎉Make it better!Up For Grabs / Hacktoberfest 💻If it's Up For Grabs, take it and run with it! If not, ask if it's in progress / you can take it.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions