Git Product home page Git Product logo

boxx's Introduction

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

boxx's People

Contributors

0xleif avatar thecodrr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.