MIT License

项目介绍

thecodrr/crayon 是一个托管在 GitHub 上的开源项目,主要使用 V 编写,采用 MIT License 许可证,目前获得 61 个 Star、5 次 Fork。

仓库全名
thecodrr/crayon
开源许可证
MIT License
Star 数
61
Fork 数
5
未关闭 Issue
1

README 摘要

🖍️ Crayon An extremely simple way to turn your bland terminal output into beautifully styled text. Installation: Install using vpkg Install using v's builtin vpm (you will need to import the module with: import thecodrr.crayon with this method of installation): Install using git: Then in the wherever you want to use it: And that's it! Usage crayon.new(texts ...string) Initializes a new Crayon for the specified…

完整内容见 GitHub 原始 README 或本页 。

常见问题

crayon 用什么语言开发?

主要使用 V 编写,采用 MIT License 许可证,目前有 61 个 Star。

crayon 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 crayon 的源码?

可以直接克隆仓库:git clone https://github.com/thecodrr/crayon.git,默认分支为 master;安装与运行步骤见仓库 README。

crayon 最近还在维护吗?

仓库最近一次更新为 2024年2月2日,当前有 1 个未关闭 Issue;Star 数为 61,可作为社区活跃度的参考。

关于

🖍️ Paint your terminal output like Picasso 🎨

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
73
价值分
38
活跃状态
活跃

语言占比

AMPL
Shell
V
Verilog

README

🖍️ 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 with this method of installation):

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 for the specified text. You can pass multiple strings in the texts argument. Nesting Crayons is supported (see example below).

crayon.new returns a Chalk by default. Turn it into a styled string using the .str() function

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 starts with { and ends with }. All styles must come at the beginning without any spaces. This function returns a string by default. You can use rgb function as rgb(92,92,92) to use custom colors.

Nested templates are currently not supported (WIP) so keep in mind that.

crayon.strip_text(text string)

Strip a styled string of all the styles returning a pure & clean string

The Crayon struct

The template API uses these same names just without the () except for the rgb usage.

Styles:

bold()

italic()

reverse()

underline()

strikethrough()

dim()

slow_blink()

rapid_blink()

Colors:

For background colors just put bg_ before each method

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() Strip the Crayon of all styles. Returns a string

len() Get the actual length of the styled string. Same as doing strip().len()

print()Print the styled stringtoterminal.

print_with(...string)Print the styled string to terminal with some additional strings

Projects Using Crayon:

  1. thecodrr.boxx

Find this library useful? :heart:

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

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.

评论

暂无评论