Skip to content

Instantly share code, notes, and snippets.

@hyuki
Last active July 7, 2019 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyuki/3eef0b67e30f2839c1dd556e9f10c9c1 to your computer and use it in GitHub Desktop.
Save hyuki/3eef0b67e30f2839c1dd556e9f10c9c1 to your computer and use it in GitHub Desktop.
# For setting color for my prompt.
# https://qiita.com/PruneMazui/items/8a023347772620025ad6
# https://gist.github.com/hyuki/3eef0b67e30f2839c1dd556e9f10c9c1
# https://snap.textfile.org/20190706230113/
PROMPT = %Q(export COLOR='%d';) + %q(PS1="[\[\e[38;5;${COLOR}m\]\u@HOSTNAME\[\e[0m\] \w] \\$ ")
256.times do |n|
s = sprintf(PROMPT, n)
printf("\e[38;5;%dm%s\e[m\n", n, s)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment