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

Proposal: configure Pure colors via prompt init #306

Closed
mafredri opened this issue Mar 18, 2017 · 7 comments · Fixed by #472
Closed

Proposal: configure Pure colors via prompt init #306

mafredri opened this issue Mar 18, 2017 · 7 comments · Fixed by #472
Labels
enhancement 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted

Comments

@mafredri
Copy link
Collaborator

mafredri commented Mar 18, 2017

Issuehunt badges

We receive a lot of requests for changing colors in Pure, one prevalent reason is color blindness and hard-to-distinguish colors. Many of the themes that ship with Zsh allow color schemeability during prompt init and I believe we could utilize this in Pure as well.

Example:

Usage: prompt pure [<status_ok_color> [<status_error_color> [<path_color> [<git_color> [<arrow_color> [<duration_color> [<username_color> [<root_color>]]]]]]]]

prompt pure magenta red blue 242 cyan yellow 242 white

These could maybe even be just color1, color2, etc.

Benefits:

  • No backwards incompatibility
  • No new environment options
  • Allows changing all colors (or as many as we expose, maybe a more limited set would be better, to begin with)

Downsides:

  • "Hard" to change just one color (previous colors must also be filled)
  • Colors can't officially1 be changed at runtime based on whatever reason, e.g. inside a read-only directory, so the user would want to change the directory prompt to red, or whatever...
  • Do we need to document how each color affects the prompt?

1 Unofficially the internals are probably such that the user could change them, but this would of course be unsupported and could break at any time.


As a bonus, we could implement prompt_pure_help to provide a help dialogue (on how to use/modify pure) for the user. This can be displayed with prompt -h pure.

References:

// ping @sindresorhus


IssueHunt Summary

[
<
i
m
g

s
r
c

'
h
t
t
p
s
:
/
/
a
v
a
t
a
r
s
3
.
g
i
t
h
u
b
u
s
e
r
c
o
n
t
e
n
t
.
c
o
m
/
u
/
5
5
2
5
6
4
6
?
v

4
'

a
l
t

'
b
r
i
c
e
w
g
e
'

w
i
d
t
h

2
4

h
e
i
g
h
t

2
4

b
r
i
c
e
w
g
e
]
(
h
t
t
p
s
:
/
/
i
s
s
u
e
h
u
n
t
.
i
o
/
u
/
b
r
i
c
e
w
g
e
)

h
a
s

b
e
e
n

r
e
w
a
r
d
e
d
.

Backers (Total: $80.00)

Submitted pull Requests


Tips


IssueHunt has been backed by the following sponsors. Become a sponsor

@sindresorhus
Copy link
Owner

Does ZSH have a nicer way to do options? I don't like positional arguments like this, and environment variables are global.

@sindresorhus
Copy link
Owner

Maybe something like zstyle ':pure:prompt' success 'green'. (No idea if this works or not)

@mafredri
Copy link
Collaborator Author

mafredri commented Apr 7, 2017

We could definitely use zstyle, it's a bit more verbose to use in the pure source, but it's just one extra line to fetch the current configuration.

What you're proposing would work, but it might be good to put them in a subcategory:

zstyle :prompt:pure:color duration yellow
zstyle :prompt:pure:color error red
zstyle :prompt:pure:color branch 242
zstyle :prompt:pure:color unpushed cyan
zstyle :prompt:pure:color unpulled cyan
zstyle :prompt:pure:color root white
zstyle :prompt:pure:color success green
zstyle :prompt:pure:color user 242

This could even allow different theming based on if you're in a git directory or not, say we started supporting mercurial:

zstyle :prompt:pure:git:color branch 242
zstyle :prompt:pure:hg:color branch red

Not sure how this would look in practice, but it should be possible. Not sure if there's value in it.

One issue with this approach is that it doesn't really decrease the amount of configuration, but perhaps allows us to keep "colors" to simply one section?

@sindresorhus
Copy link
Owner

What you're proposing would work, but it might be good to put them in a subcategory:

👍

@sindresorhus
Copy link
Owner

@mafredri So it seems we agree on the solution. Should we label this as "help wanted" (PR welcome)?

@issuehunt-oss issuehunt-oss bot added the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label May 2, 2019
@IssueHuntBot
Copy link

@IssueHunt has funded $80.00 to this issue.


@issuehunt-oss issuehunt-oss bot added 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt and removed 💵 Funded on Issuehunt This issue has been funded on Issuehunt labels Jun 20, 2019
@issuehunt-oss
Copy link

issuehunt-oss bot commented Jun 20, 2019

@sindresorhus has rewarded $72.00 to @bricewge. See it on IssueHunt

  • 💰 Total deposit: $80.00
  • 🎉 Repository reward(0%): $0.00
  • 🔧 Service fee(10%): $8.00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants