Powerlevel9k / powerlevel9k

Powerlevel9k was a tool for building a beautiful and highly functional CLI, customized for you. P9k had a substantial impact on CLI UX, and its legacy is now continued by P10k.
https://github.com/romkatv/powerlevel10k
MIT License
13.47k stars 947 forks source link

[Feature request] Individual styling options for the components of vcs prompt segment #1222

Open romkatv opened 5 years ago

romkatv commented 5 years ago

It's nice to have VCS_UNTRACKED_ICON always in the same color (the natural choice is the color of vcs segment in UNTRACKED state). I've seen configs where users attempt to do this by embedding %F tags in POWERLEVEL9K_VCS_UNTRACKED_ICON. This isn't how icons are supposed to be used, so this breaks in some corner cases.

I added support for individual styling options for the components of vcs prompt segment in Powerlevel10k and I really like it. I believe Powerlevel9k users would like it too. After much head scratching I came up with a scheme that is consistent with the existing styling options for vcs, including POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND.

Components of vcs segment can be colored individually by setting POWERLEVEL9K_VCS_${STATE}_${COMPONENT}FORMAT_FOREGROUND. ${STATE} should be one of CLEAN, UNTRACKED, MODIFIED or LOADING. ${COMPONENT} should be one of REMOTE_URL, COMMIT, BRANCH, TAG, REMOTE_BRANCH, STAGED, UNSTAGED, UNTRACKED, OUTGOING_CHANGES, INCOMING_CHANGES, STASH or ACTION. If POWERLEVEL9K_VCS_${STATE}_${COMPONENT}FORMAT_FOREGROUND isn't set for some combination of ${STATE} and ${COMPONENT}, the component is colored with POWERLEVEL9K_VCS_${COMPONENT}FORMAT_FOREGROUND. If that one isn't set either, the component is colored with POWERLEVEL9K_VCS_${STATE}_FOREGROUND.

Note that both the icon and the text in each component must have the same color. In the future we could add POWERLEVEL9K_VCS_${STATE}_${COMPONENT}FORMAT_VISUAL_IDENTIFIER_COLOR for separate coloring of icons and text.

If you could add support just for POWERLEVEL9K_VCS_${COMPONENT}FORMAT_FOREGROUND without POWERLEVEL9K_VCS_${STATE}_${COMPONENT}FORMAT_FOREGROUND, it would already be very useful. The latter is crucial for async vcs but without async it's not very useful. POWERLEVEL9K_VCS_${STATE}_${COMPONENT}FORMAT_FOREGROUND can be added later without breaking anything.