Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thecodrr/boxx
π¦ Create highly customizable terminal boxes that also look great!
https://github.com/thecodrr/boxx
bash box console terminal v
Last synced: 3 months ago
JSON representation
π¦ Create highly customizable terminal boxes that also look great!
- Host: GitHub
- URL: https://github.com/thecodrr/boxx
- Owner: thecodrr
- License: mit
- Created: 2019-11-12T14:12:59.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-01T03:45:21.000Z (over 1 year ago)
- Last Synced: 2024-06-19T03:09:32.938Z (5 months ago)
- Topics: bash, box, console, terminal, v
- Language: V
- Homepage:
- Size: 1.12 MB
- Stars: 95
- Watchers: 5
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-v - boxx - Create highly customizable terminal boxes that also look great! π¦ (Libraries / Command line interface (CLI) / Terminal / Shell)
README
π¦ Boxx
Create highly customizable terminal boxes that also look great!## Installation:
Install using `vpkg`
```bash
vpkg get https://github.com/thecodrr/boxx
```Install using `V`'s builtin `vpm`:
```bash
v install thecodrr.boxx
```Install using `git`:
```bash
cd path/to/your/project
git clone https://github.com/thecodrr/boxx
```All the awesome **color support** is made possible by [thecodrr.crayon](https://github.com/thecodrr/crayon) so install it:
```
v install thecodrr.crayon
```Then in the wherever you want to use it:
```v
import boxx // or with vpm use thecodrr.boxx
```And that's it!
## Usage
### boxx.new(`Config`)
Initializes a new `Box` with the specified `Config`
```v
box := boxx.new(boxx.Config{px: 2, py: 1, typ: "single", color: "green"})
box.print("Boxx is a great start for CLI tools.", "Welcome to Boxx!")
```### `Config`
`px`: Horizontal Padding
`py`: Vertical Padding
`content_align`: Content Alignment inside the box
`color` :`rgb` or named (see [Crayon](https://github.com/thecodrr/crayon) for possible values & usage)
`typ`: The type of box (see Box Types below)
`title_position`: choose from one of `inside`, `top` or `bottom`
#### Box Types:
**1. `single`**
**2. `single_double`**
**3. `double_single`**
**4. `bold`**
**5. `round`**
**6. `classic`**
**7. `hidden`**
**8. `double`**
#### Title Positions:
**1. `inside`**
**2. `top`**
**3. `bottom`**
### Boxx `struct`
You can create your own boxes as well if you want using the following values:
```v
struct Boxx {
top_right string //the top right corner symbol
top_left string //the top left corner symbol
vertical string //the symbol used for the vertical bars
horizontal string //the symbol used for the horizontal bars
bottom_right string //the bottom right corner symbol
bottom_left string //the bottom left corner symbol
}
```**Example:**
```v
box := &boxx.Boxx {
top_right: "x"
top_left: "x"
bottom_right: "x"
Β Β Β Β bottom_left: "x"
vertical: "+"
horizontal: "+"
}
```#### Boxx.print(`string`, `string`)
Print the box according to the specified config.
**Params:**
`text`: The text that is to appear inside the box
`title`: The title at the top of the box. It is always center aligned. (optional)
### Find this library useful? :heart:
Support it by joining **[stargazers](https://github.com/thecodrr/boxx/stargazers)** for this repository. :star:or [buy me a cup of coffee](https://ko-fi.com/thecodrr)
And **[follow](https://github.com/thecodrr)** me for my next creations! π€©### Much thanks to the developers of these repos:
1. [Atrox/box](https://github.com/Atrox/box)
2. [sindresorhus/cli-boxes](https://github.com/sindresorhus/cli-boxes)### License
```
MIT LicenseCopyright (c) 2019 Abdullah Atta
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.```