MCPcopy Index your code
hub / github.com/ZToolsCenter/ZTools / handleColorPicker

Function handleColorPicker

src/main/api/renderer/systemCommands.ts:700–724  ·  view source on GitHub ↗
(ctx: SystemCommandContext)

Source from the content-addressed store, hash-verified

698}
699
700function handleColorPicker(ctx: SystemCommandContext): Promise<any> {
701 console.log('[SystemCmd] 执行屏幕取色')
702 ctx.mainWindow?.hide()
703
704 return new Promise((resolve) => {
705 try {
706 ColorPicker.start((result) => {
707 if (result.success && result.hex) {
708 clipboard.writeText(result.hex)
709 console.log('[SystemCmd] 已复制颜色值:', result.hex)
710 if (Notification.isSupported()) {
711 new Notification({ title: 'ZTools', body: `已复制颜色值: ${result.hex}` }).show()
712 }
713 resolve({ success: true, hex: result.hex })
714 } else {
715 console.log('[SystemCmd] 取色已取消')
716 resolve({ success: false, error: '取色已取消' })
717 }
718 })
719 } catch (error) {
720 console.error('[SystemCmd] 取色失败:', error)
721 resolve({ success: false, error: String(error) })
722 }
723 })
724}
725
726/**
727 * 添加到唤醒黑名单:将唤醒前活动窗口的应用加入黑名单

Callers 1

executeSystemCommandFunction · 0.85

Calls 3

hideMethod · 0.80
showMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected