Skip to content
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

Enforce Consistency / Readability of Colors #127

Open
vexx32 opened this issue Jan 10, 2019 · 2 comments
Open

Enforce Consistency / Readability of Colors #127

vexx32 opened this issue Jan 10, 2019 · 2 comments
Labels
Category-Module Pertaining 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.
Milestone

Comments

@vexx32
Copy link
Owner

vexx32 commented Jan 10, 2019

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

@vexx32 vexx32 added 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. Category-Module Pertaining to the module's functionality itself. labels Jan 10, 2019
@vexx32 vexx32 added this to the Future milestone Jan 10, 2019
@SeeminglyScience
Copy link

@vexx32 I can probably contribute this. Do you know how many colors were you looking to use? And have you thought through what theme each one would be used for?

e.g. Bootstrap uses the terms Primary, Secondary, Success, Danger, Warning, and Info to describe colors in an abstract way.

The way I'd do it is a similar abstraction, something like WriteMessage -Scheme Primary 'message' would then translate to a $Host.UI.WriteLine call using configured colors for that theme.

@vexx32
Copy link
Owner Author

vexx32 commented Jan 10, 2019

😱 THANK YOU! ❤️

Currently we use three colors:

  • Blue for "Info" (general text and instructions)
  • Red for "Error details" (koan error message snippets and specific information)
  • As of Refactor Data Strings & Show-MeditationPrompt #126 we also have Yellow / Tan for "quotations" (random koans pilfered from compilations of Zen texts)

But if you think any of that can use improvements, go for it! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category-Module Pertaining 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.
Projects
None yet
Development

No branches or pull requests

2 participants