A Python library for generating personalized QR codes
Project description
Cool QRCode
一个用于生成个性化二维码的Python库,支持自定义颜色、形状、Logo和蒙板效果。
特性
- 🎨 自定义颜色 - 支持命名颜色和十六进制颜色代码
- ⭐ 预设风格 - 内置8种精美配色方案
- 🔘 自定义形状 - 支持方形和圆形码点
- 🖼️ 添加Logo - 支持方形和圆形Logo
- 🎭 蒙板效果 - 添加半透明色彩蒙板
- 💫 万能API - 通过单一函数支持所有效果组合
- 🚸 学生友好 - 提供简单易用的中文API和教程
安装
pip install cool-qrcode
快速开始
基本使用
from cool_qrcode import make_cool_qrcode
# 最简单的用法
make_cool_qrcode("Hello, World!", filename="basic.png")
使用预设风格
# 使用海洋风格
make_cool_qrcode(
"Hello, Ocean!",
style="ocean",
filename="ocean_style.png"
)
圆形码点
# 使用圆形码点
make_cool_qrcode(
"Hello, Circle!",
dot_shape="circle",
fill_color="green",
back_color="white",
filename="circle_dots.png"
)
添加Logo
# 添加圆形Logo
make_cool_qrcode(
"Hello, Logo!",
logo_path="your_logo.png",
logo_circular=True,
filename="with_logo.png"
)
组合所有效果
# 组合多种效果
make_cool_qrcode(
"Hello, Cool QRCode!",
style="berry", # 使用预设风格
dot_shape="circle", # 圆形码点
logo_path="logo.png", # 添加Logo
logo_circular=True, # 圆形Logo
mask_color="purple", # 紫色蒙板
mask_opacity=0.15, # 透明度
size=600, # 大尺寸
filename="cool_qr.png"
)
文档
make_cool_qrcode() 万能API
make_cool_qrcode(
data, # 二维码内容
filename=None, # 保存文件名
size=500, # 图片大小
fill_color="black", # 前景色
back_color="white", # 背景色
style=None, # 预设风格
dot_shape="square", # 码点形状
logo_path=None, # Logo路径
logo_circular=True, # Logo是否为圆形
mask_color=None, # 蒙板颜色
mask_opacity=0.3 # 蒙板透明度
)
详细使用方法参见 API文档。
支持的颜色
支持多种命名颜色和十六进制颜色代码,包括:
- 基础颜色:red, green, blue, yellow, purple, orange...
- 常用颜色:aqua, fuchsia, lime, maroon, navy, olive...
- 扩展颜色:lightblue, darkgreen, lavender...
详细颜色列表参见 颜色参考。
预设风格
内置8种精美配色方案:
- ocean - 海洋风格(蓝色系)
- forest - 森林风格(绿色系)
- sunset - 日落风格(橙色系)
- berry - 浆果风格(紫色系)
- fire - 火焰风格(红色系)
- mint - 薄荷风格(青色系)
- chocolate - 巧克力风格(棕色系)
- night - 夜空风格(深蓝系)
示例
详细示例代码见 examples 目录。
许可证
本项目采用 MIT 许可证 - 详见 LICENSE 文件
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cool_qrcode-0.1.0.tar.gz
(60.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cool_qrcode-0.1.0.tar.gz.
File metadata
- Download URL: cool_qrcode-0.1.0.tar.gz
- Upload date:
- Size: 60.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c58e86e2f91d975b36b3b4ed6ae6e68e9651e54d523a993ed2b1c167e2dffbae
|
|
| MD5 |
c38505b86d65ba35eb5bdc2ba322536f
|
|
| BLAKE2b-256 |
b4720b1fdf22a6efe4247a4dc84f705b533f97816eb18b5ff88492551d4c5516
|
File details
Details for the file cool_qrcode-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cool_qrcode-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19c8bd844c6153a964b8d30330e5c35babf818e20236564dae23e9a2b0851e89
|
|
| MD5 |
c2528c713a8e743f0d428fd96bc72ab9
|
|
| BLAKE2b-256 |
929857085a70b257ceb32bfad83a3963af056631ebd0ac6e4eb9ff917b0adfaf
|