Skip to content
📦 Create highly customizable terminal boxes that also look great!
V AMPL
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Create FUNDING.yml Nov 22, 2019
Screenshots add screenshots Nov 12, 2019
.gitignore initial commit Nov 12, 2019
LICENSE Create LICENSE Nov 12, 2019
README.md Update README.md Nov 22, 2019
boxes.v add link to cli-boxes repo Nov 12, 2019
boxx.v chore: fix up the comments a bit Nov 24, 2019
utils.v initial commit Nov 12, 2019
v.mod initial commit Nov 12, 2019
vpkg.json initial commit Nov 12, 2019

README.md

📦 Boxx

Create highly customizable terminal boxes that also look great!

Installation:

Install using vpkg

vpkg get https://github.com/thecodrr/boxx

Install using V's builtin vpm (you will need to import the module with: import thecodrr.boxx with this method of installation):

v install thecodrr.boxx

Install using git:

cd path/to/your/project
git clone https://github.com/thecodrr/boxx

All the awesome color support is made possible by thecodrr.crayon so install it:

v install thecodrr.crayon

Then in the wherever you want to use it:

import boxx

And that's it!

Usage

boxx.new(Config)

Initializes a new Box witht the specified Config

boxx.new(boxx.Config{px: 2, py: 1, typ: "single"})

Config

px: Horizontal Padding

py: Vertical Padding

content_align: Content Alignment inside the box

color :rgb or named (see Crayon for possible values & usage)

typ: The type of box (see Box Types below)

Box Types:

1. single

2. single_double

3. double_single

4. bold

5. round

6. classic

7. hidden

8. double

Boxx struct

You can create your own boxes as well if you want using the following values:

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:

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? ❤️

Support it by joining stargazers for this repository. ⭐️or buy me a cup of coffee And follow me for my next creations! 🤩

Much thanks to the developers of these repos:

  1. Atrox/box
  2. sindresorhus/cli-boxes

License

MIT License

Copyright (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.

You can’t perform that action at this time.