💿 安装
以下提到的方法 任选其一 即可
[推荐] 使用 nb-cli 安装
在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装nb plugin install nonebot-plugin-color
使用包管理器安装
在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令pip
pip install nonebot-plugin-color
pdm
pdm add nonebot-plugin-color
poetry
poetry add nonebot-plugin-color
conda
conda install nonebot-plugin-color
打开 nonebot2 项目根目录下的 pyproject.toml 文件, 在 [tool.nonebot] 部分的 plugins 项里追加写入
[tool.nonebot]
plugins = [
# ...
"nonebot_plugin_color"
]
⚙️ 配置
在 NoneBot2 项目的 .env 文件中添加下表中的必填配置
| 配置项 | 必填 | 默认值 | 说明 |
|---|---|---|---|
COLOR_FONT_FAMILIES |
否 | ... |
使用的字体名称列表 |
COLOR_REPLY |
否 | True |
是否回复用户消息 |
COLOR_SHOW_DESC |
否 | True |
是否在图片下方追加文字形式的颜色值便于复制使用 |
COLOR_SHOW_TEXT |
否 | True |
是否在生成的图片中显示色号 |
COLOR_ENABLE_ON_MESSAGE |
否 | True |
是否响应符合格式的非指令消息 |
COLOR_HEX_WITH_SIGN |
否 | True |
是否在 HEX 颜色代码前有 # 才进行响应 |
COLOR_ON_MESSAGE_PRIORITY |
否 | 5 |
非指令消息响应优先级 |
COLOR_TEXT_BLACK_N_WHITE |
否 | False |
图片中的文字是否只使用黑色和白色 |
🎉 使用
插件基于 pydantic 的 Color 类解析颜色,将下方支持的颜色值格式作为指令 color / 色图 的参数发送即可
- 颜色别名:
yellow/黄/黄色(插件对部分中文颜色别名做了处理,支持的名称列表见 const.py) - 十六进制(HEX):
#ff0/#ff0f/#ffff00/#ffff00ff/0xff0/ff0 - CSS RGB / RGBA:
rgb(255, 255, 0)/rgba(255, 255, 255, 0.5) - CSS HSL:
hsl(60, 100%, 50%)/hsl(60, 100%, 50%, 0.5) - RGB / RGBA(空格分隔):
255 255 0/255 255 0 128/255 255 0 0.5(A 小于 1 时代表百分比)
插件还支持渐变色,将上面支持的颜色格式使用 ; 或 ; 分隔即可生成渐变色图片,同样支持透明度,例:color f00;0f0;00f
不!够!色!我要五彩斑斓的黑和五颜六色的白!
哎哟这个色啊!好色!
📞 联系
QQ:3076823485
Telegram:@lgc2333
吹水群:1105946125
邮箱:lgc2333@126.com
💡 鸣谢
💰 赞助
感谢大家的赞助!你们的赞助将是我继续创作的动力!
📝 更新日志
0.5.0
- 适配 pil-utils 0.2
- 去掉了内置字体,新增配置项让用户配置默认字体
0.4.2
- 修复 #7 (可能)
0.4.1
- 添加配置
COLOR_TEXT_BLACK_N_WHITE以使图片中文字仅为黑色和白色 - 优化渐变色展示
0.4.0
- 适配 Pydantic V1 & V2
0.3.2
- 新增配置项
COLOR_HEX_WITH_SIGN
0.3.1
- 修复标题字号不会被正确缩小的 bug
- 新增配置项
COLOR_SHOW_TEXT
0.3.0
- 支持了渐变色(#1)
- 添加了一些配置项:
COLOR_REPLYCOLOR_SHOW_DESCCOLOR_ENABLE_ON_MESSAGECOLOR_ON_MESSAGE_PRIORITY
0.2.0
- 重构项目
Metadata
Release files for nonebot-plugin-color 0.5.0.post1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nonebot_plugin_color-0.5.0.post1.tar.gz | 12.3 kB | Without provenance | Details for nonebot_plugin_color-0.5.0.post1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nonebot_plugin_color-0.5.0.post1-py3-none-any.whl | Python 3 | none | any | Details for nonebot_plugin_color-0.5.0.post1-py3-none-any.whl |
Total release size: 24.6 kB
Release files / nonebot_plugin_color-0.5.0.post1.tar.gz
| Download URL | nonebot_plugin_color-0.5.0.post1.tar.gz |
|---|---|
| Size | 12.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
64df428f2298d506be843057f4a832b5162c58ee95ee46e59b1c963207b6fb47
|
|
BLAKE2b-256 checksum How to use checksums |
805d9c5e05a1569e79c2528d033e991443bd051d24ad9687df9245a013cd6559
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.20.1 CPython/3.10.12 Linux/6.5.0-1025-azure
|
Release files / nonebot_plugin_color-0.5.0.post1-py3-none-any.whl
| Download URL | nonebot_plugin_color-0.5.0.post1-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5c77fd652fc5461e7f41d3a5b23ff8c89339ddce24bbd7fe167dccb7a174f398
|
|
BLAKE2b-256 checksum How to use checksums |
2149b33b027f43fc003fb8418c4708818c540fb1b21f9fd8e16091aa024081e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.20.1 CPython/3.10.12 Linux/6.5.0-1025-azure
|
Security for nonebot-plugin-color 0.5.0.post1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.