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/copy-color

v2.0.8

Published

EW Color Picker Copy Color Plugin

Readme

@ew-color-picker/copy-color

ew-color-picker 的复制颜色插件,一键把当前颜色写入系统剪贴板。

功能特性

  • 圆形按钮底色跟随当前颜色,图标颜色按对比度自动切换
  • 优先使用异步剪贴板 API,失败时降级到 document.execCommand('copy')
  • 复制成功后弹出内置提示气泡,并提供回调
  • 支持隐藏按钮、自定义提示文案

安装

npm install @ew-color-picker/copy-color

使用

import ewColorPicker from '@ew-color-picker/core';
import CopyColor from '@ew-color-picker/copy-color';

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

// 创建颜色选择器
const colorPicker = new ewColorPicker({
  el: '#color-picker',
  showCopyColor: true,
  copyColorText: '复制颜色到剪贴板',
  copiedText: '已复制',
  onCopyColor: (color) => {
    console.log('已复制颜色:', color);
  },
});

API

配置选项

| 参数 | 类型 | 默认值 | 说明 | |------|------|--------|------| | showCopyColor | boolean | true | 是否显示复制颜色按钮 | | copyColorText | string | '复制颜色到剪贴板' | 按钮的 title / aria-label | | copiedText | string | '已复制' | 复制成功后临时显示的提示文案 | | onCopyColor | (color: string) => void | - | 复制成功回调,参数为复制的颜色值 |

剪贴板支持

插件优先调用 navigator.clipboard.writeText();在不支持剪贴板 API 或调用被拒绝的环境下,会创建一个临时 textarea 并使用 document.execCommand('copy') 作为降级方案。

::: tip 异步剪贴板 API 通常要求页面处于安全上下文(https 或 localhost)。两种方式都失败时,控制台会输出警告。 :::

许可证

MIT