nonebot-plugin-color


Namenonebot-plugin-color JSON
Version 0.3.2 PyPI version JSON
download
home_pagehttps://github.com/monsterxcn/nonebot-plugin-color
SummaryA specified color image generator for Nonebot2
upload_time2024-02-07 10:04:10
maintainer
docs_urlNone
author
requires_python<4.0,>=3.8
licenseMIT
keywords nonebot nonebot2 color
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!-- markdownlint-disable MD031 MD033 MD036 MD041 -->

<div align="center">

<a href="https://v2.nonebot.dev/store">
  <img src="https://raw.githubusercontent.com/A-kirami/nonebot-plugin-template/resources/nbp_logo.png" width="180" height="180" alt="NoneBotPluginLogo">
</a>

<p>
  <img src="https://raw.githubusercontent.com/A-kirami/nonebot-plugin-template/resources/NoneBotPlugin.svg" width="240" alt="NoneBotPluginText">
</p>

# NoneBot-Plugin-Color

_✨ 用于生成指定色彩图片的 NoneBot2 插件 ✨_

<img src="https://img.shields.io/badge/python-3.8+-blue.svg" alt="python">
<a href="https://pdm.fming.dev">
  <img src="https://img.shields.io/badge/pdm-managed-blueviolet" alt="pdm-managed">
</a>

<br />

<a href="./LICENSE">
  <img src="https://img.shields.io/github/license/monsterxcn/nonebot-plugin-color.svg" alt="license">
</a>
<a href="https://pypi.python.org/pypi/nonebot-plugin-color">
  <img src="https://img.shields.io/pypi/v/nonebot-plugin-color.svg" alt="pypi">
</a>
<a href="https://pypi.python.org/pypi/nonebot-plugin-color">
  <img src="https://img.shields.io/pypi/dm/nonebot-plugin-color" alt="pypi download">
</a>

</div>

## 💿 安装

以下提到的方法 任选**其一** 即可

<details open>
<summary>[推荐] 使用 nb-cli 安装</summary>
在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装

```bash
nb plugin install nonebot-plugin-color
```

</details>

<details>
<summary>使用包管理器安装</summary>
在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令

<details>
<summary>pip</summary>

```bash
pip install nonebot-plugin-color
```

</details>
<details>
<summary>pdm</summary>

```bash
pdm add nonebot-plugin-color
```

</details>
<details>
<summary>poetry</summary>

```bash
poetry add nonebot-plugin-color
```

</details>
<details>
<summary>conda</summary>

```bash
conda install nonebot-plugin-color
```

</details>

打开 nonebot2 项目根目录下的 `pyproject.toml` 文件, 在 `[tool.nonebot]` 部分的 `plugins` 项里追加写入

```toml
[tool.nonebot]
plugins = [
    # ...
    "nonebot_plugin_color"
]
```

</details>

## ⚙️ 配置

在 NoneBot2 项目的 `.env` 文件中添加下表中的必填配置

|           配置项            | 必填 | 默认值 |                      说明                      |
| :-------------------------: | :--: | :----: | :--------------------------------------------: |
|        `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`   |              非指令消息响应优先级              |

## 🎉 使用

插件基于 `pydantic` 的 `Color` 类解析颜色,将下方支持的颜色值格式作为指令 `color` / `色图` 的参数发送即可

- 颜色别名:`yellow` / `黄` / `黄色`(插件对部分中文颜色别名做了处理,支持的名称列表见 [const.py](./nonebot_plugin_color/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`  
~~不!够!色!我要五彩斑斓的黑和五颜六色的白!~~

<details>
<summary><i>哎哟这个色啊!好色!</i></summary>

![色图来咯](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/color/screenshot.png)  
![色图又来咯](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/color/screenshot2.png)

</details>

## 📞 联系

QQ:3076823485  
Telegram:[@lgc2333](https://t.me/lgc2333)  
吹水群:[1105946125](https://jq.qq.com/?_wv=1027&k=Z3n1MpEp)  
邮箱:<lgc2333@126.com>

## 💡 鸣谢

- [@nonebot/nonebot2](https://github.com/nonebot/nonebot2/)
- [@nonebot/plugin-alconna](https://github.com/nonebot/plugin-alconna)
- [@Mrs4s/go-cqhttp](https://github.com/Mrs4s/go-cqhttp)

## 💰 赞助

感谢大家的赞助!你们的赞助将是我继续创作的动力!

- [爱发电](https://afdian.net/@lgc2333)
- <details>
    <summary>赞助二维码(点击展开)</summary>

  ![讨饭](https://raw.githubusercontent.com/lgc2333/ShigureBotMenu/master/src/imgs/sponsor.png)

  </details>

## 📝 更新日志

### 0.3.1

- 修复标题字号不会被正确缩小的 bug
- 新增配置项 `COLOR_SHOW_TEXT`

### 0.3.0

- 支持了渐变色([#1](https://github.com/lgc-NB2Dev/nonebot-plugin-color/issues/1))
- 添加了一些配置项:
  - `COLOR_REPLY`
  - `COLOR_SHOW_DESC`
  - `COLOR_ENABLE_ON_MESSAGE`
  - `COLOR_ON_MESSAGE_PRIORITY`

### 0.2.0

- 重构项目

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/monsterxcn/nonebot-plugin-color",
    "name": "nonebot-plugin-color",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": "",
    "keywords": "nonebot nonebot2 color",
    "author": "",
    "author_email": "monsterxcn <monsterxcn@gmail.com>, student_2333 <lgc2333@126.com>",
    "download_url": "https://files.pythonhosted.org/packages/27/78/77094e92afbbfc559327517859c8c98bb5ee2d432d5180c6ead5efc5178d/nonebot_plugin_color-0.3.2.tar.gz",
    "platform": null,
    "description": "<!-- markdownlint-disable MD031 MD033 MD036 MD041 -->\n\n<div align=\"center\">\n\n<a href=\"https://v2.nonebot.dev/store\">\n  <img src=\"https://raw.githubusercontent.com/A-kirami/nonebot-plugin-template/resources/nbp_logo.png\" width=\"180\" height=\"180\" alt=\"NoneBotPluginLogo\">\n</a>\n\n<p>\n  <img src=\"https://raw.githubusercontent.com/A-kirami/nonebot-plugin-template/resources/NoneBotPlugin.svg\" width=\"240\" alt=\"NoneBotPluginText\">\n</p>\n\n# NoneBot-Plugin-Color\n\n_\u2728 \u7528\u4e8e\u751f\u6210\u6307\u5b9a\u8272\u5f69\u56fe\u7247\u7684 NoneBot2 \u63d2\u4ef6 \u2728_\n\n<img src=\"https://img.shields.io/badge/python-3.8+-blue.svg\" alt=\"python\">\n<a href=\"https://pdm.fming.dev\">\n  <img src=\"https://img.shields.io/badge/pdm-managed-blueviolet\" alt=\"pdm-managed\">\n</a>\n\n<br />\n\n<a href=\"./LICENSE\">\n  <img src=\"https://img.shields.io/github/license/monsterxcn/nonebot-plugin-color.svg\" alt=\"license\">\n</a>\n<a href=\"https://pypi.python.org/pypi/nonebot-plugin-color\">\n  <img src=\"https://img.shields.io/pypi/v/nonebot-plugin-color.svg\" alt=\"pypi\">\n</a>\n<a href=\"https://pypi.python.org/pypi/nonebot-plugin-color\">\n  <img src=\"https://img.shields.io/pypi/dm/nonebot-plugin-color\" alt=\"pypi download\">\n</a>\n\n</div>\n\n## \ud83d\udcbf \u5b89\u88c5\n\n\u4ee5\u4e0b\u63d0\u5230\u7684\u65b9\u6cd5 \u4efb\u9009**\u5176\u4e00** \u5373\u53ef\n\n<details open>\n<summary>[\u63a8\u8350] \u4f7f\u7528 nb-cli \u5b89\u88c5</summary>\n\u5728 nonebot2 \u9879\u76ee\u7684\u6839\u76ee\u5f55\u4e0b\u6253\u5f00\u547d\u4ee4\u884c, \u8f93\u5165\u4ee5\u4e0b\u6307\u4ee4\u5373\u53ef\u5b89\u88c5\n\n```bash\nnb plugin install nonebot-plugin-color\n```\n\n</details>\n\n<details>\n<summary>\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u5b89\u88c5</summary>\n\u5728 nonebot2 \u9879\u76ee\u7684\u63d2\u4ef6\u76ee\u5f55\u4e0b, \u6253\u5f00\u547d\u4ee4\u884c, \u6839\u636e\u4f60\u4f7f\u7528\u7684\u5305\u7ba1\u7406\u5668, \u8f93\u5165\u76f8\u5e94\u7684\u5b89\u88c5\u547d\u4ee4\n\n<details>\n<summary>pip</summary>\n\n```bash\npip install nonebot-plugin-color\n```\n\n</details>\n<details>\n<summary>pdm</summary>\n\n```bash\npdm add nonebot-plugin-color\n```\n\n</details>\n<details>\n<summary>poetry</summary>\n\n```bash\npoetry add nonebot-plugin-color\n```\n\n</details>\n<details>\n<summary>conda</summary>\n\n```bash\nconda install nonebot-plugin-color\n```\n\n</details>\n\n\u6253\u5f00 nonebot2 \u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u7684 `pyproject.toml` \u6587\u4ef6, \u5728 `[tool.nonebot]` \u90e8\u5206\u7684 `plugins` \u9879\u91cc\u8ffd\u52a0\u5199\u5165\n\n```toml\n[tool.nonebot]\nplugins = [\n    # ...\n    \"nonebot_plugin_color\"\n]\n```\n\n</details>\n\n## \u2699\ufe0f \u914d\u7f6e\n\n\u5728 NoneBot2 \u9879\u76ee\u7684 `.env` \u6587\u4ef6\u4e2d\u6dfb\u52a0\u4e0b\u8868\u4e2d\u7684\u5fc5\u586b\u914d\u7f6e\n\n|           \u914d\u7f6e\u9879            | \u5fc5\u586b | \u9ed8\u8ba4\u503c |                      \u8bf4\u660e                      |\n| :-------------------------: | :--: | :----: | :--------------------------------------------: |\n|        `COLOR_REPLY`        |  \u5426  | `True` |                \u662f\u5426\u56de\u590d\u7528\u6237\u6d88\u606f                |\n|      `COLOR_SHOW_DESC`      |  \u5426  | `True` | \u662f\u5426\u5728\u56fe\u7247\u4e0b\u65b9\u8ffd\u52a0\u6587\u5b57\u5f62\u5f0f\u7684\u989c\u8272\u503c\u4fbf\u4e8e\u590d\u5236\u4f7f\u7528 |\n|      `COLOR_SHOW_TEXT`      |  \u5426  | `True` |           \u662f\u5426\u5728\u751f\u6210\u7684\u56fe\u7247\u4e2d\u663e\u793a\u8272\u53f7           |\n|  `COLOR_ENABLE_ON_MESSAGE`  |  \u5426  | `True` |          \u662f\u5426\u54cd\u5e94\u7b26\u5408\u683c\u5f0f\u7684\u975e\u6307\u4ee4\u6d88\u606f          |\n|    `COLOR_HEX_WITH_SIGN`    |  \u5426  | `True` |     \u662f\u5426\u5728 `HEX` \u989c\u8272\u4ee3\u7801\u524d\u6709 `#` \u624d\u8fdb\u884c\u54cd\u5e94    |\n| `COLOR_ON_MESSAGE_PRIORITY` |  \u5426  |  `5`   |              \u975e\u6307\u4ee4\u6d88\u606f\u54cd\u5e94\u4f18\u5148\u7ea7              |\n\n## \ud83c\udf89 \u4f7f\u7528\n\n\u63d2\u4ef6\u57fa\u4e8e `pydantic` \u7684 `Color` \u7c7b\u89e3\u6790\u989c\u8272\uff0c\u5c06\u4e0b\u65b9\u652f\u6301\u7684\u989c\u8272\u503c\u683c\u5f0f\u4f5c\u4e3a\u6307\u4ee4 `color` / `\u8272\u56fe` \u7684\u53c2\u6570\u53d1\u9001\u5373\u53ef\n\n- \u989c\u8272\u522b\u540d\uff1a`yellow` / `\u9ec4` / `\u9ec4\u8272`\uff08\u63d2\u4ef6\u5bf9\u90e8\u5206\u4e2d\u6587\u989c\u8272\u522b\u540d\u505a\u4e86\u5904\u7406\uff0c\u652f\u6301\u7684\u540d\u79f0\u5217\u8868\u89c1 [const.py](./nonebot_plugin_color/const.py)\uff09\n- \u5341\u516d\u8fdb\u5236\uff08HEX\uff09\uff1a`#ff0` / `#ff0f` / `#ffff00` / `#ffff00ff` / `0xff0` / `ff0`\n- CSS RGB / RGBA\uff1a`rgb(255, 255, 0)` / `rgba(255, 255, 255, 0.5)`\n- CSS HSL\uff1a`hsl(60, 100%, 50%)` / `hsl(60, 100%, 50%, 0.5)`\n- RGB / RGBA\uff08\u7a7a\u683c\u5206\u9694\uff09\uff1a`255 255 0` / `255 255 0 128` / `255 255 0 0.5`\uff08A \u5c0f\u4e8e 1 \u65f6\u4ee3\u8868\u767e\u5206\u6bd4\uff09\n\n\u63d2\u4ef6\u8fd8\u652f\u6301\u6e10\u53d8\u8272\uff0c\u5c06\u4e0a\u9762\u652f\u6301\u7684\u989c\u8272\u683c\u5f0f\u4f7f\u7528 `;` \u6216 `\uff1b` \u5206\u9694\u5373\u53ef\u751f\u6210\u6e10\u53d8\u8272\u56fe\u7247\uff0c\u540c\u6837\u652f\u6301\u900f\u660e\u5ea6\uff0c\u4f8b\uff1a`color f00;0f0;00f`  \n~~\u4e0d\uff01\u591f\uff01\u8272\uff01\u6211\u8981\u4e94\u5f69\u6591\u6593\u7684\u9ed1\u548c\u4e94\u989c\u516d\u8272\u7684\u767d\uff01~~\n\n<details>\n<summary><i>\u54ce\u54df\u8fd9\u4e2a\u8272\u554a\uff01\u597d\u8272\uff01</i></summary>\n\n![\u8272\u56fe\u6765\u54af](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/color/screenshot.png)  \n![\u8272\u56fe\u53c8\u6765\u54af](https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/color/screenshot2.png)\n\n</details>\n\n## \ud83d\udcde \u8054\u7cfb\n\nQQ\uff1a3076823485  \nTelegram\uff1a[@lgc2333](https://t.me/lgc2333)  \n\u5439\u6c34\u7fa4\uff1a[1105946125](https://jq.qq.com/?_wv=1027&k=Z3n1MpEp)  \n\u90ae\u7bb1\uff1a<lgc2333@126.com>\n\n## \ud83d\udca1 \u9e23\u8c22\n\n- [@nonebot/nonebot2](https://github.com/nonebot/nonebot2/)\n- [@nonebot/plugin-alconna](https://github.com/nonebot/plugin-alconna)\n- [@Mrs4s/go-cqhttp](https://github.com/Mrs4s/go-cqhttp)\n\n## \ud83d\udcb0 \u8d5e\u52a9\n\n\u611f\u8c22\u5927\u5bb6\u7684\u8d5e\u52a9\uff01\u4f60\u4eec\u7684\u8d5e\u52a9\u5c06\u662f\u6211\u7ee7\u7eed\u521b\u4f5c\u7684\u52a8\u529b\uff01\n\n- [\u7231\u53d1\u7535](https://afdian.net/@lgc2333)\n- <details>\n    <summary>\u8d5e\u52a9\u4e8c\u7ef4\u7801\uff08\u70b9\u51fb\u5c55\u5f00\uff09</summary>\n\n  ![\u8ba8\u996d](https://raw.githubusercontent.com/lgc2333/ShigureBotMenu/master/src/imgs/sponsor.png)\n\n  </details>\n\n## \ud83d\udcdd \u66f4\u65b0\u65e5\u5fd7\n\n### 0.3.1\n\n- \u4fee\u590d\u6807\u9898\u5b57\u53f7\u4e0d\u4f1a\u88ab\u6b63\u786e\u7f29\u5c0f\u7684 bug\n- \u65b0\u589e\u914d\u7f6e\u9879 `COLOR_SHOW_TEXT`\n\n### 0.3.0\n\n- \u652f\u6301\u4e86\u6e10\u53d8\u8272\uff08[#1](https://github.com/lgc-NB2Dev/nonebot-plugin-color/issues/1)\uff09\n- \u6dfb\u52a0\u4e86\u4e00\u4e9b\u914d\u7f6e\u9879\uff1a\n  - `COLOR_REPLY`\n  - `COLOR_SHOW_DESC`\n  - `COLOR_ENABLE_ON_MESSAGE`\n  - `COLOR_ON_MESSAGE_PRIORITY`\n\n### 0.2.0\n\n- \u91cd\u6784\u9879\u76ee\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A specified color image generator for Nonebot2",
    "version": "0.3.2",
    "project_urls": {
        "Bug tracker": "https://github.com/monsterxcn/nonebot-plugin-color/issues",
        "Documentation": "https://github.com/monsterxcn/nonebot-plugin-color#readme",
        "Homepage": "https://github.com/monsterxcn/nonebot-plugin-color"
    },
    "split_keywords": [
        "nonebot",
        "nonebot2",
        "color"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e82dd14f1e44a90917271f8b36b6f127abf166132aa02e9a1b446b780c76f297",
                "md5": "062b9f421fba9aaaef0c417eb9fb0b19",
                "sha256": "3738725da49c76f6f38c66c4b566de5fbb17f1b216b84670ca4a7814055d28fa"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_color-0.3.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "062b9f421fba9aaaef0c417eb9fb0b19",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 72932,
            "upload_time": "2024-02-07T10:04:08",
            "upload_time_iso_8601": "2024-02-07T10:04:08.432360Z",
            "url": "https://files.pythonhosted.org/packages/e8/2d/d14f1e44a90917271f8b36b6f127abf166132aa02e9a1b446b780c76f297/nonebot_plugin_color-0.3.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "277877094e92afbbfc559327517859c8c98bb5ee2d432d5180c6ead5efc5178d",
                "md5": "74880056517638d7fc9a3591d9878235",
                "sha256": "7ef770d97f52813bcd2c32d20c5cce4d843a98dfbce274836dd5d78ffa669d99"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_color-0.3.2.tar.gz",
            "has_sig": false,
            "md5_digest": "74880056517638d7fc9a3591d9878235",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 73769,
            "upload_time": "2024-02-07T10:04:10",
            "upload_time_iso_8601": "2024-02-07T10:04:10.002798Z",
            "url": "https://files.pythonhosted.org/packages/27/78/77094e92afbbfc559327517859c8c98bb5ee2d432d5180c6ead5efc5178d/nonebot_plugin_color-0.3.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-07 10:04:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "monsterxcn",
    "github_project": "nonebot-plugin-color",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nonebot-plugin-color"
}
        
Elapsed time: 0.22123s