Skip to content
/ boxx Public

📦 Create highly customizable terminal boxes that also look great!

License

Notifications You must be signed in to change notification settings

thecodrr/boxx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📦 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:

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 // or with vpm use thecodrr.boxx

And that's it!

Usage

boxx.new(Config)

Initializes a new Box with the specified Config

    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 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:

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.

About

📦 Create highly customizable terminal boxes that also look great!

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •