Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2 from blyndusk/v2
Browse files Browse the repository at this point in the history
V2
  • Loading branch information
Alexandre Delaloy authored Apr 9, 2020
2 parents ff0c662 + 3647414 commit 37a96df
Show file tree
Hide file tree
Showing 13 changed files with 410 additions and 272 deletions.
133 changes: 13 additions & 120 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
<img src="./docs/logo.png" width="200" />


# sm-theme

<a href="https://github.com/blyndusk/sm-theme/releases/latest"><img src="https://img.shields.io/github/release/blyndusk/sm-theme.svg" alt="sm-theme last release"/></a>
Expand All @@ -9,140 +6,36 @@
<a href="https://github.com/blyndusk/sm-theme/blob/master/LICENSE" alt="sm license"><img src="https://img.shields.io/github/license/blyndusk/sm-theme.svg"/></a>
<a href="https://github.com/blyndusk/sm-theme" alt="sm license"><img src="https://img.shields.io/github/stars/blyndusk/sm-theme?color=878787"/></a>

**sm-theme** is a **Simplistic** & **Minimalist** theme for **`ZSH`** prompts.
**sm-theme** is a **Simplistic** & **Minimalist** theme for **`Bash`** and **`Zsh`** prompts.

![sm-theme](./docs/sm-theme.gif)
![sm-theme](./docs/sm-prompt.gif)

> ⚠️ This theme better fit with **Fira Code** font.
## I - Install

### Oh-My-Zsh

If you're using [Oh-My-Zsh](https://github.com/robbyrussell/oh-my-zsh):

1. Clone this repository:

```bash
git clone https://github.com/blyndusk/sm-theme.git
```

2. Install `sm.zsh-theme` in `~/.oh-my-zsh/` folder:

```bash
# at the root of this repository
> source install.sh --zsh
source ./install.sh
```

3. Update `ZSH_THEME` theme in your `.zshrc`

```bash
21 # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
22 ZSH_THEME="sm" # probably was ZSH_THEME="robbyrussell (default)
23
24 # Set list of themes to pick from when loading at random
```

### Antigen

If you're using [Antigen](https://github.com/zsh-users/antigen):
This script will:
- **select** your actual shell (`Bash|Zsh`)
- **copy** the theme file into your **user root** (`~`)
- **check** for a `.[ba|z]shrc` file to **source** the theme file
- **replace** your actual prompt with the **sm** one

1. Add `antigen bundle blyndusk/sm-theme` to your `.zshrc` where you've listed your other plugins.
2. Close and reopen your Terminal/iTerm window to **refresh context** and use the plugin. Alternatively, you can run `antigen bundle blyndusk/sm-theme` in a running shell to have `antigen` load the new plugin.

### zgen

If you're using [zgen](https://github.com/tarjoilija/zgen):

1. Add `zgen load blyndusk/sm-theme` to your `.zshrc` along with your other `zgen load` commands.
2. `zgen reset && zgen save`

## II - Customization

To custom this theme, there is **three** configuration variables:

- `SM_SMILEYS`: enable or disable **smileys**
- `SM_CORNERS`: enable or disable **corners**
- `SM_MULTILINES`: enable or disable **multilines**

By default, **all features are *enabled***.
### Bash

```bash
# SM_SMILEYS=1 => with smileys, using "[ಠ_ಠ]" & "[・‿・]"
# SM_SMILEYS=0 => without smileys, using "✘" & "✔︎"
SM_SMILEYS=1

# SM_CORNERS=1 => the prompt's corner aren't rounded: "╭"
# SM_CORNERS=0 => the prompt's corner are rounded: "╓"
SM_CORNERS=1

# SM_MULTILINES=1 => the prompt is displayed on 3 lines
# SM_MULTILINES=0 => the prompt is displayed on 2 lines
SM_MULTILINES=1
source ./install.sh --bash
```

### 1. Smileys
### Zsh

#### With smileys

```bash
07 SM_SMILEYS=1
```zsh
source ./install.sh --zsh
```

![smileys clean](./docs/sm-smileys-clean.png)
![smileys dirty](./docs/sm-smileys-dirty.png)

#### Without smileys

```bash
07 SM_SMILEYS=0
```

![no smileys clean](./docs/sm-no-smileys-clean.png)
![no smileys dirty](./docs/sm-no-smileys-dirty.png)

### 2. Corners

#### With corners

```bash
11 SM_CORNERS=1
```

![corners](./docs/sm-smileys-clean.png)

#### Without corners ( rounded )

```bash
11 SM_CORNERS=0
```

![no corners](./docs/sm-no-corners.png)

### 3. Multiline

#### With mutliline ( on 3 lines )

```bash
15 SM_MULTILINES=1
```

![corners](./docs/sm-smileys-clean.png)

#### Without mutliline ( on 2 lines )

```bash
15 SM_MULTILINES=0
```

![no corners](./docs/sm-no-multilines.png)

## III - Curated List

- [oh-my-zsh themes](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes)
- [oh-my-zsh external themes](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes)
- [awesome-zsh-plugins](https://github.com/unixorn/awesome-zsh-plugins)

## IV - License

Under [MIT](https://github.com/blyndusk/sm-theme/blob/master/LICENSE) license.
Binary file removed docs/sm-no-corners.png
Binary file not shown.
Binary file removed docs/sm-no-multilines.png
Binary file not shown.
Binary file removed docs/sm-no-smileys-clean.png
Binary file not shown.
Binary file removed docs/sm-no-smileys-dirty.png
Binary file not shown.
Binary file added docs/sm-prompt.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/sm-smileys-clean.png
Binary file not shown.
Binary file removed docs/sm-smileys-dirty.png
Binary file not shown.
Binary file removed docs/sm-theme.gif
Binary file not shown.
87 changes: 64 additions & 23 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,71 @@
#!/bin/bash

local happy_face="\e[32m[・‿・]\e[0m"
local sad_face="\e[31m[ಠ_ಠ]\e[0m"

install_zsh() {
if [ -d !~/.oh-my-zsh ] ; then echo -e "$sad_face It seems that there is no \e[1;34moh-my-zsh\e[0m folder at the root of this user"
else
cp ./sm.zsh-theme ~/.oh-my-zsh/themes
if [ -f ~/.oh-my-zsh/themes/sm.zsh-theme ]; then echo -e "$happy_face Congrats! \e[1;34msm-theme\e[0m is installed for \e[1;34mzsh\e[0m !" ;
else echo -e "$sad_face Uh oh.. Something went wrong.." ; fi
fi
R="\e[0;31m[!]\e[0m";
G="\e[0;32m[v]\e[0m";
Y="\e[0;33m[?]\e[0m";

clear;

copy_theme() {
STATUS="";
if [ ! -f ~/.$THEME_FILE ] ; then
# the file doesn't and will installed
STATUS="installed"
else
# the file exist, has previously been installed, and will be updated
STATUS="updated"
fi
# copy the desired file to the file destination
cp $THEME_FILE ~/.$THEME_FILE;
}

check_rc_file_existence() {
if [ ! -f ~/$CONFIG_FILE ] ; then
echo "$Y $CONFIG_FILE file was not found";
touch ~/$CONFIG_FILE;
echo "$G $CONFIG_FILE file has been created";
else
echo "$G $CONFIG_FILE file exist";
fi
}

install_bash() {
cp ./sm.bash-theme ~
if ! grep "source ./sm.bash-theme" ~/.bashrc | clear; then printf "\n\nsource ./sm.bash-theme" >> ~/.bashrc ; fi
if [ -f ~/sm.bash-theme ]; then echo -e "$happy_face Congrats! \e[1;34msm-theme\e[0m is installed for \e[1;34mbash\e[0m !" ;
else echo -e "$sad_face Uh oh.. Something went wrong.." ; fi
source_theme() {
local STRING="source ~/.$THEME_FILE"
if [ $(cat ~/$CONFIG_FILE | grep $STRING | wc -l) -eq 0 ] ; then
echo "\n$STRING" >> ~/$CONFIG_FILE;
source ~/$CONFIG_FILE;
echo "$G Theme sourced.";
fi
source ~/.$THEME_FILE;
}

clear
install_theme() {
copy_theme;
check_rc_file_existence;
source_theme;
echo "$G sm-prompt correctly $STATUS for $1";
}

confirm() {
printf "$Y You've choose $1 shell. Continue ? [Y/n] ";
read -r OUTPUT;
if [[ $OUTPUT =~ ^([yY][eE][sS]|[yY])$ ]] ; then
install_theme $1;
else
echo "$R Process cancelled"
fi
}

if [[ "$1" = "--zsh" || "$1" = "-z" ]] ; then install_zsh
elif [[ "$1" = "--bash" || "$1" = "-b" ]] ; then install_bash
elif [[ "$1" = "--all" || "$1" = "-a" || ! "$1" ]] ; then
install_zsh
install_bash
clear ; echo -e "$happy_face Congrats! All\e[1;34m sm-theme\e[0m added !"
else echo "$sad_face Please specify an environment, ie '\e[1;34m--zsh\e[0m' or '\e[1;34m--bash\e[0m'" ; fi
if [ "$1" = "--zsh" ]; then
CONFIG_FILE=.zshrc;
THEME_FILE=sm.zsh-theme;
confirm "ZSH"
elif [ "$1" = "--bash" ]; then
CONFIG_FILE=.bashrc;
THEME_FILE=sm.bash-theme;
confirm "BASH"
else
CONFIG_FILE=.bashrc;
THEME_FILE=sm.bash-theme;
confirm "BASH"
fi
Loading

0 comments on commit 37a96df

Please sign in to comment.