🖍️ Crayon
An extremely simple way to turn your bland terminal output into beautifully styled text.
Installation:
Install using
vpkg
vpkg get https://github.com/thecodrr/crayon
Install using v's builtin vpm (you will need to import the module with:
import thecodrr.crayon
v install thecodrr.crayon
Install using
git
cd path/to/your/project
git clone https://github.com/thecodrr/crayon
# Or add it as a submodule
git submodule add https://github.com/thecodrr/crayon crayon && git submodule update --init --recursive
Then in the wherever you want to use it:
import crayon
And that's it!
Usage
crayon.new(texts ...
string
)
Initializes a new
Crayon
texts
Crayon
crayon.new
Chalk
string
.str()
crayon.new("Hello", crayon.new("world").bold().str()).cyan().underline().str()
crayon.color(text
string
)
Use this to style the text using the template API.
crayon.color("{bold.underline I am bold and underlined} and I am not")
Each
template
{
}
string
rgb
rgb(92,92,92)
Nested templates
crayon.strip_text(text
string
)
Strip a styled
string
string
The Crayon
struct
The
template
()
rgb
Styles:
bold()
italic()
reverse()
underline()
strikethrough()
dim()
slow_blink()
rapid_blink()
Colors:
For background colors just put
bg_
black()
white()
red()
green()
yellow()
blue()
magenta()
cyan()
light_gray()
dark_gray()
light_red()
light_green()
light_yellow()
light_blue()
light_magenta()
light_cyan()
RGB Support
rbg(int,int,int)
Other Methods:
strip()
Crayon
string
len()
string
strip().len()
print()
string
terminal
print_with(...string)
string
strings
Projects Using Crayon:
Find this library useful? :heart:
Support it by joining
stargazers
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.