Giter Club home page Giter Club logo

qalam's Introduction

Qalam ✏️

Qalam is a Go library for easy terminal styling. Example for what qalam can do

Installation

go get github.com/iskaa02/qalam

Usage

func main(){
	// this will output "a red text" with red in terminal
	// you can use qalam.Sprintf() if you don't want to print yet
	qalam.Printf("[red]a red %s[/red]","text")
}
Code Style
b/bold bold text
i/italic italic text
u/underline underline text
s/strikethrough strikethrough text
#hexcode change the color
bg#hexcode change the background color
red change the color to red
yellow change the color to yellow
magenta change the color to magenta
white change the color to white
black change the color to black
green change the color to green
cyan change the color to cyan
bg.(color) change the background color to any color mentioned above

Examples

Multiple styles

qalam.Printf("[b s]bold and strikethrough[/b s]")

outputs: bold and strikethrough

Composing styles

qalam.Printf("[b]bold only [i]bold and italic[/i][/b]")

outputs: bold only bold and italic

Emoji

// outputs "this is a vampire -> 🧛"
qalam.Printf("this is a vampire ->[:vampire:]")

Style

You can use style function to apply style to string

// this is equivalent for qalam.Sprintf("[bold]this text is bold[/bold]") 
qalam.Style("this text is bold","bold")

Emoji

You can use get emoji function to return an emoji

// returns '🍎'
qalam.Emoji("red_apple")

What does the Qalam mean

Qalam in Arabic means pencil

Compatibility

ANSI work a bit different depending on the operating system, this implementation should work for MacOS, Linux and Windows, Although it's only been tested on Linux.

qalam's People

Contributors

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