npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ew-color-picker/eyedropper

v2.0.8

Published

EW Color Picker Eyedropper Plugin

Readme

@ew-color-picker/eyedropper

ew-color-picker 的吸管取色插件,基于浏览器原生 EyeDropper API,从屏幕任意位置拾取颜色并写回选择器。

功能特性

  • 一键从屏幕取色,写回当前颜色
  • 自动检测浏览器能力,不支持时不渲染按钮
  • 支持隐藏按钮、自定义按钮提示文案
  • 取色成功回调
  • 用户取消取色时静默处理,不抛出异常

安装

npm install @ew-color-picker/eyedropper

使用

import ewColorPicker from '@ew-color-picker/core';
import Eyedropper from '@ew-color-picker/eyedropper';

// 注册插件
ewColorPicker.use(Eyedropper);

// 创建颜色选择器
const colorPicker = new ewColorPicker({
  el: '#color-picker',
  showEyedropper: true,
  eyedropperText: '取色',
  onEyedropperPick: (color) => {
    console.log('拾取到的颜色:', color);
  },
});

API

配置选项

| 参数 | 类型 | 默认值 | 说明 | |------|------|--------|------| | showEyedropper | boolean | true | 是否显示吸管按钮;浏览器不支持 EyeDropper API 时始终不渲染 | | eyedropperText | string | '取色' | 按钮的 title / aria-label;设置后同时作为可见文本显示 | | onEyedropperPick | (color: string) => void | - | 取色成功回调,参数为 sRGBHex 颜色值 |

浏览器支持

EyeDropper API 目前在 Chromium 系浏览器(Chrome / Edge 等)中可用。其他浏览器(如 Firefox、Safari 及部分 iframe 环境)不受支持,此时插件不会渲染按钮。

::: tip 部分浏览器要求 EyeDropper 必须在用户手势(如点击)中调用,且跨域 iframe 内可能被拒绝。 :::

许可证

MIT