clink icon indicating copy to clipboard operation
clink copied to clipboard

How to change colors of Pure prompt?

Open m-ad opened this issue 1 year ago • 1 comments

Hi, thanks for this great tool!

I activated the "Pure" prompt and like it, except for the colors. How can I change them?

What I tried so far:

  • The Pure prompt colors are not affected by changing the Clink theme
  • I tried changing some colors with clink set, but that did not affect the usernanme/path/venv/git labels that the prompt provided.
  • I looked at https://github.com/sindresorhus/pure, but I think the ways described there for setting colors only work for a zsh shell and not for Windows cmd with Clink. Creating a .zshrc file as described there did not do anything.

m-ad avatar Oct 25 '24 06:10 m-ad

Look in the pure.clinkprompt file.



P.S. if you're asking how to set environment variables on Windows, there are many different ways which can be found with internet searches.

One way is to set them in a Startup CMD Script.

chrisant996 avatar Oct 25 '24 14:10 chrisant996

Thanks! Took me still a couple of minutes to figure out how to actually do it, so I am documenting it here.

Excerpt from pure.clinkprompt:

--  These environment variables override the default colors.  Set them to the
--  SGR Parameters of an ANSI escape code color.  For more information on ANSI
--  color codes and SGR Parameters, visit wikipedia:
--  https://en.wikipedia.org/wiki/ANSI_escape_code#SGR
--      PURE_COLOR_EXECUTION_TIME
--      PURE_COLOR_GIT_ARROW
--      PURE_COLOR_GIT_STASH
--      PURE_COLOR_GIT_BRANCH
--      PURE_COLOR_GIT_ACTION
--      PURE_COLOR_GIT_DIRTY
--      PURE_COLOR_HOST_AT
--      PURE_COLOR_HOST
--      PURE_COLOR_PATH
--      PURE_COLOR_PROMPT_ERROR
--      PURE_COLOR_PROMPT_SUCCESS
--      PURE_COLOR_USER
--      PURE_COLOR_USER_ROOT
--      PURE_COLOR_VIRTUALENV

Then, use the 8-bit color code from https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit, e.g. 214 for a nice orange. The environment variable then needs to have the value sgr 38;5;214:

set PURE_COLOR_VIRTUALENV=sgr 38;5;214

Note: The sgr 38;5; part is always the same, don't add quotation marks or anything.

m-ad avatar Oct 28 '24 15:10 m-ad

@m-ad Yes, but that's incomplete.

The color format is described here.

And for example you can also use set PURE_COLOR_VARIABLE=#RRGGBB where #RRGGBB is a hexadecimal RGB color code.

chrisant996 avatar Oct 28 '24 17:10 chrisant996

I've updated the comments in pure.clinkprompt with links to the accurate syntax description. @m-ad Thanks for catching this.

chrisant996 avatar Oct 29 '24 05:10 chrisant996