https://github.com/info-mono/powerbg
➡️ Add background color to strings in Powerline ways
https://github.com/info-mono/powerbg
ansi basher bpkg cli color info-mono posix powerline terminal
Last synced: 8 months ago
JSON representation
➡️ Add background color to strings in Powerline ways
- Host: GitHub
- URL: https://github.com/info-mono/powerbg
- Owner: info-mono
- License: gpl-3.0
- Created: 2021-05-17T05:38:22.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-08T09:05:53.000Z (almost 4 years ago)
- Last Synced: 2025-01-06T05:25:33.363Z (10 months ago)
- Topics: ansi, basher, bpkg, cli, color, info-mono, posix, powerline, terminal
- Language: Shell
- Homepage:
- Size: 43.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## 💡 About
**PowerBG** is a tool that add to color string's background like [Powerline](https://github.com/powerline/powerline) written in [`portable sh`](https://github.com/dylanaraps/pure-sh-bible).## 🚀 Setup
### 🧾 Dependencies
- [Unix commands](https://en.wikipedia.org/wiki/List_of_Unix_commands) to process### 📥 Installation
#### 🔧 Manually
Option 1: using `curl`
```sh
curl https://raw.githubusercontent.com/info-mono/powerbg/main/bin/powerbg > ~/.local/bin/powerbg
chmod +x ~/.local/bin/powerbg
```Option 2: using `git`
```sh
git clone https://github.com/info-mono/powerbg.git ~/.local/share/powerbg
ln -s ~/.local/share/powerbg/bin/powerbg ~/.local/bin/powerbg
```#### 📦 Package manager
For [Bpkg](https://github.com/bpkg/bpkg) user:
```sh
bpkg install info-mono/powerbg
```For [Basher](https://github.com/basherpm/basher) user:
```sh
basher install info-mono/powerbg
```> *If you can and want to port PowerBG to other package managers, feel free to do so.*
## ⌨️ Usage
Run `powerbg` in the terminal:
```sh
powerbg COLOR STRING COLOR STRING COLOR STRING ...
```Examples:
```sh
powerbg '0' "$USER" '8' "$PWD"
```
```sh
POWERBG_LEFTEND_OUTER='' \
POWERBG_RIGHTEND_OUTER='' \
POWERBG_SEPARATOR_RIGHT=' ' \
POWERBG_SEPARATOR_SAME=' \033[30m ' \
powerbg '1' '\033[30mRed' '3' '\033[30mYellow' '3' '\033[30mYellow again' '2' '\033[30mGreen' '6' '\033[30mCyan' '4' '\033[30mBlue' '5' '\033[30mPurple'
```
```sh
green='\033[30mTree'
cyan='\033[30mSky'
blue='\033[30mWater'
purple='' # Nothing
red='\033[30mApple'POWERBG_LEFTEND_OUTER='' \
POWERBG_RIGHTEND_OUTER='' \
POWERBG_SEPARATOR_RIGHT=' ' \
POWERBG_SEPARATOR_SAME=' \033[30m ' \
powerbg '2' "$green" '6' "$cyan" '4' "$blue" '5' "$purple" '1' "$red"
```
## ⚙️ Configuration
PowerBG is configured through environment variables: `export POWERBG_=""`
|Environment variable |Valid |Default|Description |
|-------------------------|----------|-------|---------------------------------------------------------------------------------|
|`POWERBG_LEFTEND_OUTER` |``|*none* |Set left end outer string |
|`POWERBG_LEFTEND_INNER` |``|*none* |Set left end inner string |
|`POWERBG_RIGHTEND_OUTER` |``|`` |Set right end outer string |
|`POWERBG_RIGHTEND_INNER` |``|*none* |Set right end inner string |
| | | | |
|`POWERBG_SEPARATOR_LEFT` |``|*none* |Set separator left string |
|`POWERBG_SEPARATOR_RIGHT`|``|` ` |Set separator right string |
|`POWERBG_SEPARATOR_SAME` |``|`` |Set separator string to use when when separating two elements with the same color|## 💌 Credits
Special thanks to:
- [**Powerline**](https://github.com/powerline/powerline) by [Powerline organization](https://github.com/orgs/powerline/people)
---
>
Made with ❤️ by
@info-mono
>
>