├── LICENSE
├── README.md
└── cool.zsh-theme
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Melanie Sawyer
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # cool: a zsh theme
2 |
3 | ### preview:
4 |
5 |
6 |
7 | ## setup how-to
8 | I'd recommend installing powerline patched fonts: https://github.com/powerline/fonts
9 |
10 | This theme goes best with a solarized-dark terminal. (I use VSCode & set the color theme of my editor to solarized dark)
11 |
12 | #### To install, clone the repo & move the theme into your zsh themes directory: [^1].
13 |
14 | ```console
15 | git clone https://github.com/soybean/cool-zsh.git; cd cool-zsh; cp cool.zsh-theme ~/.oh-my-zsh/themes
16 | ```
17 |
18 | #### Open your `.zshrc` and set the theme like so:
19 |
20 | ```console
21 | ZSH_THEME="cool"
22 | ```
23 |
24 | #### Cleanup:
25 |
26 | ```console
27 | cd ..; rm -rf cool-zsh
28 | ```
29 |
30 | You can also experiment with other color gradients:
31 |
32 |
33 |
34 |
35 |
36 |
37 | If you'd like to customize the colors yourself, run this block of code in your terminal & you'll see the full 256 terminal colors:
38 |
39 | ```console
40 | for COLOR in {0..255}
41 | do
42 | for STYLE in "38;5"
43 | do
44 | TAG="\033[${STYLE};${COLOR}m"
45 | STR="${STYLE};${COLOR}"
46 | echo -ne "${TAG}${STR}${NONE} "
47 | done
48 | echo
49 | done
50 | ```
51 |
52 | output:
53 |
54 |
55 |
56 |
57 |
58 | [^1]: path to your themes directory may vary, replace `oh-my-zsh/themes` with your path
59 |
--------------------------------------------------------------------------------
/cool.zsh-theme:
--------------------------------------------------------------------------------
1 | # __ ___ ___ _
2 | # / ] / \ / \ | |
3 | # / / | || || |
4 | # / / | O || O || |___
5 | # / \_ | || || |
6 | # \ || || || |
7 | # \____| \___/ \___/ |_____|
8 | # a zshell theme created by mel sawyer (@soybean)
9 |
10 | gradient=(36 37 38 39 75 111 75 39 38 37 36)
11 | iterator=1
12 | len=(${#gradient[@]})
13 | fg="%F{black}"
14 |
15 | () {
16 | local LC_ALL="" LC_CTYPE="en_US.UTF-8"
17 | SEGMENT_SEPARATOR=$'\ue0b0'
18 | }
19 |
20 |
21 | render_segment() {
22 | local bg
23 | non_formatted=$gradient[(($iterator%$len))]
24 | bg="%K{$non_formatted}"
25 | echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} "
26 | CURRENT_BG=$non_formatted
27 | ((iterator++))
28 | [[ -n $1 ]] && echo -n $1
29 | }
30 |
31 | end_prompt() {
32 | echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR"
33 | echo -n "%{%f%}"
34 | }
35 |
36 | render_git() {
37 | local ref
38 | if [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then
39 | ref="\u26a1$(git symbolic-ref --short HEAD 2> /dev/null)"
40 | render_segment
41 | echo -n "${ref}"
42 | fi
43 | }
44 |
45 | render_directories() {
46 | IFS="/" read -rA dir_path <<< $(pwd)
47 | for value in "${dir_path[@]:1}"
48 | do
49 | render_segment $value
50 | done
51 | }
52 |
53 |
54 | render_prompt() {
55 | render_git
56 | render_directories
57 | end_prompt
58 | }
59 |
60 | PROMPT='%{%f%b%k%}$(render_prompt) '
61 |
--------------------------------------------------------------------------------