qrcode

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateQRCodeImage

func CreateQRCodeImage(text string, size int, filename string) error

func ShowQRCodeFromText added in v0.0.9

func ShowQRCodeFromText(text string, timeout time.Duration, width int,
	successChan <-chan bool, cancelChan chan<- bool, timeoutChan chan<- bool) error

ShowQRCodeFromText 从文本内容本地生成 QR 码并通过 Bubble Tea 展示。

设计说明(D-06, D-07, D-08): - 完全本地生成,不发起 HTTP 请求 - 支持 --width 参数控制显示宽度 - 支持自动终端检测(width=0 时) - 保留与 ShowQRCodeWithCallback 相同的 channel 通信接口 - 支持 Kitty/iTerm2 图片协议,不支持时降级到半块字符

渲染流程: 1. 检测终端图片协议 2. 如果支持 Kitty/iTerm2:

  • 生成 QR 码图片
  • 在 Bubble Tea 之前显示图片
  • 启动 Bubble Tea 只处理倒计时

3. 如果不支持:

  • 降级到半块字符渲染
  • 启动 Bubble Tea 处理倒计时和字符渲染

参数: - text: QR 码内容(通常是登录 URL) - timeout: 二维码显示超时时间 - width: 目标显示宽度(列数),0 表示自动检测 - successChan: 接收登录成功通知的 channel - cancelChan: 发送用户取消通知的 channel - timeoutChan: 发送超时通知的 channel

func ShowQRCodeWithCallback added in v0.0.5

func ShowQRCodeWithCallback(imageURL string, timeout time.Duration, successChan <-chan bool, cancelChan chan<- bool, timeoutChan chan<- bool) error

ShowQRCodeWithCallback 使用 lipgloss 和 bubbletea 展示二维码,支持外部通知与交互

func ShowQRCodeWithLipgloss added in v0.0.5

func ShowQRCodeWithLipgloss(imageURL string, timeout time.Duration) error

ShowQRCodeWithLipgloss 使用lipgloss和bubbletea展示二维码(基于字符渲染)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL