# 一个易于使用的终端输出彩色文本库
## 环境及安装
对于python版本没有太多的要求,只要不低于python 3.6应该都可以正常使用
使用pip安装:`pip install mini-color`
## 快速上手
在终端打印一串某个颜色的文本,你只需要像这样:
```python
from mini_color.color import red
print(red('我只是一个输出'))
```
color中包含了所有可以使用print函数输出彩色字符的颜色方法
这将在终端输出红色的字符串
color中的内容:
black(),white(),red(),yellow(),blue(),green(),cyan(),purple(),
random_color()
其中random_color()是一个能够将输入的字符串转为随机颜色的方法
## 进阶:使用背景色
你只需要导入一个Color类,并在颜色方法中将Color中的属性传入back参数:
```python
from mini_color.color import Color,green
text = green(
'我只是一个输出',
back=Color.BLUE
)
print(text)
```
这将在终端输出绿色字体、蓝色背景的字符串
Color的属性内容同上面的color类似,因为在所有的颜色方法中都调用了Color中的颜色属性
Color类:
BLACK,WHITE,RED,YELLOW,BLUE,GREEN,CYAN,PURPLE,
random()
random()是一个方法,他能返回随机一个Color的颜色属性,这在color方法中也是可以作为参数传入的
## 进阶:使用样式
你只需要导入一个Style类,并在颜色方法中将Style中的属性传入style参数
```python
from mini_color.color import Color,Style,red
text = red(
'我只是一个输出',
back=Color.BLUE,
style=Style.HighLight
)
print(text)
```
这将在终端输出红色字体、蓝色背景、带有高亮效果的字符串
Style中包含的样式:
Default:默认样式,没有任何显示效果
HighLight:高亮显示
UnderLine:下划线效果
Flash:闪烁效果
AntiWhite:反白的显示效果
Invisible:不可见
## 联系我
QQ:1435608435
Raw data
{
"_id": null,
"home_page": "https://github.com/Kaguya233qwq/MiniColor",
"name": "mini-color",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "colored-text,library,\u5f69\u8272\u6587\u672c",
"author": "Kaguya233qwq",
"author_email": "1435608435@qq.com",
"download_url": "https://files.pythonhosted.org/packages/78/98/ea6d1fbd98b065c61b7f7699efa715c85cdb7f406a1fda5a6fdeb4cf8cb9/mini_color-0.1.0.tar.gz",
"platform": "any",
"description": "# \u4e00\u4e2a\u6613\u4e8e\u4f7f\u7528\u7684\u7ec8\u7aef\u8f93\u51fa\u5f69\u8272\u6587\u672c\u5e93\r\n\r\n## \u73af\u5883\u53ca\u5b89\u88c5\r\n\r\n\u5bf9\u4e8epython\u7248\u672c\u6ca1\u6709\u592a\u591a\u7684\u8981\u6c42\uff0c\u53ea\u8981\u4e0d\u4f4e\u4e8epython 3.6\u5e94\u8be5\u90fd\u53ef\u4ee5\u6b63\u5e38\u4f7f\u7528\r\n\r\n\u4f7f\u7528pip\u5b89\u88c5\uff1a`pip install mini-color`\r\n\r\n## \u5feb\u901f\u4e0a\u624b\r\n\r\n\u5728\u7ec8\u7aef\u6253\u5370\u4e00\u4e32\u67d0\u4e2a\u989c\u8272\u7684\u6587\u672c\uff0c\u4f60\u53ea\u9700\u8981\u50cf\u8fd9\u6837\uff1a\r\n\r\n```python\r\nfrom mini_color.color import red\r\n\r\nprint(red('\u6211\u53ea\u662f\u4e00\u4e2a\u8f93\u51fa'))\r\n```\r\ncolor\u4e2d\u5305\u542b\u4e86\u6240\u6709\u53ef\u4ee5\u4f7f\u7528print\u51fd\u6570\u8f93\u51fa\u5f69\u8272\u5b57\u7b26\u7684\u989c\u8272\u65b9\u6cd5\r\n\r\n\u8fd9\u5c06\u5728\u7ec8\u7aef\u8f93\u51fa\u7ea2\u8272\u7684\u5b57\u7b26\u4e32\r\n\r\ncolor\u4e2d\u7684\u5185\u5bb9\uff1a\r\n\r\n black(),white(),red(),yellow(),blue(),green(),cyan(),purple(),\r\n\r\n random_color()\r\n\r\n\u5176\u4e2drandom_color()\u662f\u4e00\u4e2a\u80fd\u591f\u5c06\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u8f6c\u4e3a\u968f\u673a\u989c\u8272\u7684\u65b9\u6cd5\r\n\r\n## \u8fdb\u9636\uff1a\u4f7f\u7528\u80cc\u666f\u8272\r\n\r\n\u4f60\u53ea\u9700\u8981\u5bfc\u5165\u4e00\u4e2aColor\u7c7b\uff0c\u5e76\u5728\u989c\u8272\u65b9\u6cd5\u4e2d\u5c06Color\u4e2d\u7684\u5c5e\u6027\u4f20\u5165back\u53c2\u6570\uff1a\r\n\r\n```python\r\n\r\nfrom mini_color.color import Color,green\r\n\r\ntext = green(\r\n '\u6211\u53ea\u662f\u4e00\u4e2a\u8f93\u51fa',\r\n back=Color.BLUE\r\n)\r\nprint(text)\r\n```\r\n\u8fd9\u5c06\u5728\u7ec8\u7aef\u8f93\u51fa\u7eff\u8272\u5b57\u4f53\u3001\u84dd\u8272\u80cc\u666f\u7684\u5b57\u7b26\u4e32\r\n\r\nColor\u7684\u5c5e\u6027\u5185\u5bb9\u540c\u4e0a\u9762\u7684color\u7c7b\u4f3c\uff0c\u56e0\u4e3a\u5728\u6240\u6709\u7684\u989c\u8272\u65b9\u6cd5\u4e2d\u90fd\u8c03\u7528\u4e86Color\u4e2d\u7684\u989c\u8272\u5c5e\u6027\r\n\r\nColor\u7c7b\uff1a\r\n\r\n BLACK,WHITE,RED,YELLOW,BLUE,GREEN,CYAN,PURPLE,\r\n\r\n random()\r\n\r\nrandom()\u662f\u4e00\u4e2a\u65b9\u6cd5\uff0c\u4ed6\u80fd\u8fd4\u56de\u968f\u673a\u4e00\u4e2aColor\u7684\u989c\u8272\u5c5e\u6027\uff0c\u8fd9\u5728color\u65b9\u6cd5\u4e2d\u4e5f\u662f\u53ef\u4ee5\u4f5c\u4e3a\u53c2\u6570\u4f20\u5165\u7684\r\n \r\n\r\n## \u8fdb\u9636\uff1a\u4f7f\u7528\u6837\u5f0f\r\n\r\n\u4f60\u53ea\u9700\u8981\u5bfc\u5165\u4e00\u4e2aStyle\u7c7b\uff0c\u5e76\u5728\u989c\u8272\u65b9\u6cd5\u4e2d\u5c06Style\u4e2d\u7684\u5c5e\u6027\u4f20\u5165style\u53c2\u6570\r\n\r\n```python\r\n\r\nfrom mini_color.color import Color,Style,red\r\n\r\ntext = red(\r\n '\u6211\u53ea\u662f\u4e00\u4e2a\u8f93\u51fa',\r\n back=Color.BLUE,\r\n style=Style.HighLight\r\n)\r\nprint(text)\r\n```\r\n\u8fd9\u5c06\u5728\u7ec8\u7aef\u8f93\u51fa\u7ea2\u8272\u5b57\u4f53\u3001\u84dd\u8272\u80cc\u666f\u3001\u5e26\u6709\u9ad8\u4eae\u6548\u679c\u7684\u5b57\u7b26\u4e32\r\n\r\nStyle\u4e2d\u5305\u542b\u7684\u6837\u5f0f\uff1a\r\n\r\n Default\uff1a\u9ed8\u8ba4\u6837\u5f0f\uff0c\u6ca1\u6709\u4efb\u4f55\u663e\u793a\u6548\u679c\r\n \r\n HighLight\uff1a\u9ad8\u4eae\u663e\u793a\r\n\r\n UnderLine\uff1a\u4e0b\u5212\u7ebf\u6548\u679c\r\n\r\n Flash\uff1a\u95ea\u70c1\u6548\u679c\r\n\r\n AntiWhite\uff1a\u53cd\u767d\u7684\u663e\u793a\u6548\u679c\r\n\r\n Invisible\uff1a\u4e0d\u53ef\u89c1\r\n\r\n## \u8054\u7cfb\u6211\r\n\r\nQQ:1435608435\r\n\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "",
"summary": "mini_color",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/Kaguya233qwq/MiniColor"
},
"split_keywords": [
"colored-text",
"library",
"\u5f69\u8272\u6587\u672c"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7898ea6d1fbd98b065c61b7f7699efa715c85cdb7f406a1fda5a6fdeb4cf8cb9",
"md5": "62400edbb5710603e06123bf993c1412",
"sha256": "b324a5ae93851f08b86c1d751d7ddbe08fd99c883624e1fd8a48d306710eb4e0"
},
"downloads": -1,
"filename": "mini_color-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "62400edbb5710603e06123bf993c1412",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3780,
"upload_time": "2023-06-06T10:19:05",
"upload_time_iso_8601": "2023-06-06T10:19:05.957661Z",
"url": "https://files.pythonhosted.org/packages/78/98/ea6d1fbd98b065c61b7f7699efa715c85cdb7f406a1fda5a6fdeb4cf8cb9/mini_color-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-06 10:19:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Kaguya233qwq",
"github_project": "MiniColor",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "mini-color"
}