Skip to content

Instantly share code, notes, and snippets.

@romkatv
Last active March 16, 2023 17:44
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romkatv/afdbb534051304ef0e2e85a46adb276f to your computer and use it in GitHub Desktop.
Save romkatv/afdbb534051304ef0e2e85a46adb276f to your computer and use it in GitHub Desktop.
monochrome-powerlevel10k.zsh

Here's how it looks with White on Black color scheme:

white-on-black

Tango Dark

tango-dark

Solarized Light

solarized-light

# Run `p10k configure` and select "Classic" style.
# Then run this script to convert`~/.p10k.zsh` to "Monochrome" style.
() {
emulate -L zsh
local extra=(
'typeset -g POWERLEVEL9K_BACKGROUND='
'typeset -g POWERLEVEL9K_FOREGROUND='
'typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL="%f$POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL%S"'
'typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL="%s%f$POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL"'
'typeset -g POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL="%f$POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL%S"'
'typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL="%s%f$POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL"'
)
command sed -E -i.bak \
-e '/(BACKGROUND|FOREGROUND|VISUAL_IDENTIFIER_COLOR)=/d' \
-e 's/%[[:digit:]]*F//g' \
-e "s/^\\}\$/${(j:; :)extra} }/" \
~/.p10k.zsh
}
@pravinsingh
Copy link

If anyone is wondering how to get these color gradients at the beginning/end of the prompt, I created a gist that you can use in your .p10k.zsh

@romkatv
Copy link
Author

romkatv commented Mar 16, 2023

@pravinsingh Alternatively, you can use a terminal with a builtin support for unicode block elements and choose Blurred heads and tails in the configuration wizard. That's how the screenshots above and on the powerlevel10k homepage were produced.

@pravinsingh
Copy link

@romkatv On my terminal (iTerm on Mac), the blurred heads from the config wizard look like this:
image

but the code I have can still create this in my Terminal:
image

I have spent a lot of time trying to get the heads like in your screenshots and I finally got it right after a lot of hit-and-trial (based on your this gist, so thank you).

@romkatv
Copy link
Author

romkatv commented Mar 16, 2023

iTerm2 doesn't have builtin support for unicode block elements.

@romkatv
Copy link
Author

romkatv commented Mar 16, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment