Skip to content

Pika

Pika 是 macOS 的原生颜色选择器工具。Protocol Launcher 允许您生成深度链接以控制 Pika 的颜色选择、格式和外观设置。

使用方式

有两种使用此库的方式:

  • 按需导入(On-Demand):从子路径导入支持 tree-shaking,保持较小的打包体积。
  • 完整导入(Full Import):从根包导入更方便,但会包含所有应用模块。

生产构建建议选择按需导入;快速脚本或演示可以使用完整导入。

选择安装方式

按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。

操作(Actions)

交换颜色(Swap)

On-Demand
ts
import { swap } from 'protocol-launcher/pika'

const url = swap()

撤销(Undo)

On-Demand
ts
import { undo } from 'protocol-launcher/pika'

const url = undo()

重做(Redo)

On-Demand
ts
import { redo } from 'protocol-launcher/pika'

const url = redo()

外观(Appearance)

浅色模式(Light)

On-Demand
ts
import { light } from 'protocol-launcher/pika'

const url = light()

深色模式(Dark)

On-Demand
ts
import { dark } from 'protocol-launcher/pika'

const url = dark()

系统模式(System)

On-Demand
ts
import { system } from 'protocol-launcher/pika'

const url = system()

复制(Copy)

复制前景色

On-Demand
ts
import { copyForeground } from 'protocol-launcher/pika'

const url = copyForeground()

复制背景色

On-Demand
ts
import { copyBackground } from 'protocol-launcher/pika'

const url = copyBackground()

复制文本

On-Demand
ts
import { copyText } from 'protocol-launcher/pika'

const url = copyText()

复制 JSON

On-Demand
ts
import { copyJson } from 'protocol-launcher/pika'

const url = copyJson()

格式(Format)

Hex 格式

On-Demand
ts
import { formatHex } from 'protocol-launcher/pika'

const url = formatHex()

RGB 格式

On-Demand
ts
import { formatRgb } from 'protocol-launcher/pika'

const url = formatRgb()

HSB 格式

On-Demand
ts
import { formatHsb } from 'protocol-launcher/pika'

const url = formatHsb()

HSL 格式

On-Demand
ts
import { formatHsl } from 'protocol-launcher/pika'

const url = formatHsl()

LAB 格式

On-Demand
ts
import { formatLab } from 'protocol-launcher/pika'

const url = formatLab()

OpenGL 格式

On-Demand
ts
import { formatOpenGL } from 'protocol-launcher/pika'

const url = formatOpenGL()

OKLCH 格式

On-Demand
ts
import { formatOklch } from 'protocol-launcher/pika'

const url = formatOklch()

历史记录(History)

显示历史记录

On-Demand
ts
import { showHistory } from 'protocol-launcher/pika'

const url = showHistory()

隐藏历史记录

On-Demand
ts
import { hideHistory } from 'protocol-launcher/pika'

const url = hideHistory()

切换历史记录

On-Demand
ts
import { toggleHistory } from 'protocol-launcher/pika'

const url = toggleHistory()

选取(Pick)

选取前景色

On-Demand
ts
import { pickForeground } from 'protocol-launcher/pika'

const url = pickForeground({
  type: 'hex',
})

选取背景色

On-Demand
ts
import { pickBackground } from 'protocol-launcher/pika'

const url = pickBackground({
  type: 'rgb',
})

设置颜色(Set Color)

设置前景色

On-Demand
ts
import { setForeground } from 'protocol-launcher/pika'

const url = setForeground({
  hex: 'fbbf24',
})

设置背景色

On-Demand
ts
import { setBackground } from 'protocol-launcher/pika'

const url = setBackground({
  hex: 'e74661',
})

系统(System)

系统前景色选择器

On-Demand
ts
import { systemForeground } from 'protocol-launcher/pika'

const url = systemForeground()

系统背景色选择器

On-Demand
ts
import { systemBackground } from 'protocol-launcher/pika'

const url = systemBackground()

窗口(Window)

关于(About)

On-Demand
ts
import { about } from 'protocol-launcher/pika'

const url = about()

帮助(Help)

On-Demand
ts
import { help } from 'protocol-launcher/pika'

const url = help()

偏好设置(Preferences)

On-Demand
ts
import { preferences } from 'protocol-launcher/pika'

const url = preferences()

调整窗口大小(Resize)

On-Demand
ts
import { resize } from 'protocol-launcher/pika'

const url = resize({
  width: 480,
  height: 300,
})