Pika
Pika 是 macOS 的原生颜色选择器工具。Protocol Launcher 允许您生成深度链接以控制 Pika 的颜色选择、格式和外观设置。
使用方式
有两种使用此库的方式:
- 按需导入(On-Demand):从子路径导入支持 tree-shaking,保持较小的打包体积。
- 完整导入(Full Import):从根包导入更方便,但会包含所有应用模块。
生产构建建议选择按需导入;快速脚本或演示可以使用完整导入。
选择安装方式
按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。
操作(Actions)
交换颜色(Swap)
ts
import { swap } from 'protocol-launcher/pika'
const url = swap()撤销(Undo)
ts
import { undo } from 'protocol-launcher/pika'
const url = undo()重做(Redo)
ts
import { redo } from 'protocol-launcher/pika'
const url = redo()外观(Appearance)
浅色模式(Light)
ts
import { light } from 'protocol-launcher/pika'
const url = light()深色模式(Dark)
ts
import { dark } from 'protocol-launcher/pika'
const url = dark()系统模式(System)
ts
import { system } from 'protocol-launcher/pika'
const url = system()复制(Copy)
复制前景色
ts
import { copyForeground } from 'protocol-launcher/pika'
const url = copyForeground()复制背景色
ts
import { copyBackground } from 'protocol-launcher/pika'
const url = copyBackground()复制文本
ts
import { copyText } from 'protocol-launcher/pika'
const url = copyText()复制 JSON
ts
import { copyJson } from 'protocol-launcher/pika'
const url = copyJson()格式(Format)
Hex 格式
ts
import { formatHex } from 'protocol-launcher/pika'
const url = formatHex()RGB 格式
ts
import { formatRgb } from 'protocol-launcher/pika'
const url = formatRgb()HSB 格式
ts
import { formatHsb } from 'protocol-launcher/pika'
const url = formatHsb()HSL 格式
ts
import { formatHsl } from 'protocol-launcher/pika'
const url = formatHsl()LAB 格式
ts
import { formatLab } from 'protocol-launcher/pika'
const url = formatLab()OpenGL 格式
ts
import { formatOpenGL } from 'protocol-launcher/pika'
const url = formatOpenGL()OKLCH 格式
ts
import { formatOklch } from 'protocol-launcher/pika'
const url = formatOklch()历史记录(History)
显示历史记录
ts
import { showHistory } from 'protocol-launcher/pika'
const url = showHistory()隐藏历史记录
ts
import { hideHistory } from 'protocol-launcher/pika'
const url = hideHistory()切换历史记录
ts
import { toggleHistory } from 'protocol-launcher/pika'
const url = toggleHistory()选取(Pick)
选取前景色
ts
import { pickForeground } from 'protocol-launcher/pika'
const url = pickForeground({
type: 'hex',
})选取背景色
ts
import { pickBackground } from 'protocol-launcher/pika'
const url = pickBackground({
type: 'rgb',
})设置颜色(Set Color)
设置前景色
ts
import { setForeground } from 'protocol-launcher/pika'
const url = setForeground({
hex: 'fbbf24',
})设置背景色
ts
import { setBackground } from 'protocol-launcher/pika'
const url = setBackground({
hex: 'e74661',
})系统(System)
系统前景色选择器
ts
import { systemForeground } from 'protocol-launcher/pika'
const url = systemForeground()系统背景色选择器
ts
import { systemBackground } from 'protocol-launcher/pika'
const url = systemBackground()窗口(Window)
关于(About)
ts
import { about } from 'protocol-launcher/pika'
const url = about()帮助(Help)
ts
import { help } from 'protocol-launcher/pika'
const url = help()偏好设置(Preferences)
ts
import { preferences } from 'protocol-launcher/pika'
const url = preferences()调整窗口大小(Resize)
ts
import { resize } from 'protocol-launcher/pika'
const url = resize({
width: 480,
height: 300,
})