@antonlimar/react-color

中文文档
3.0.10发布于 2026/09/25MITTypeScriptES Module近 30 天下载 4070

A Collection of Color Pickers from Sketch, Photoshop, Chrome & more

原始使用文档
文档目录7 节
  1. Fork development
  2. Development workflow
  3. Packaging interop notes
  4. Demo
  5. Installation & Usage
  6. Include the Component
  7. Styling

React Color

Npm Version License Downloads

  • 14 Different Pickers - Sketch, Photoshop, Chrome, Google and many more

  • Make Your Own - Use the building block components to make your own

Fork development

This tree is maintained as a modernization fork. Source layout, npm export names, and agent-oriented conventions are documented in AGENTS.md. Do not edit generated es/ by hand; use the build scripts from package.json.

Compatibility notes: the published API remains intentionally stable where practical, but repository internals have been modernized. In particular, runtime propTypes are no longer emitted, so JavaScript consumers should rely on docs and TypeScript typings rather than prop-types warnings during development.

Development workflow

The modernization branch now uses a TypeScript-based ESM emit for package builds, Vitest for tests, Storybook 10 for component work, and Vite for the GitHub Pages documentation site in site/.

CommandPurpose
npm run buildBuild the published ESM output in es/.
npm run test:unitRun the unit/UI test suite through Vitest.
npm run test:siteRun the dedicated site interaction tests for navigation and shared color state.
npm run test:esm-consumptionBuild the package and smoke-check Node ESM and bundler consumption paths.
npm run test:watchStart Vitest in watch mode.
npm run eslintLint src, site, scripts, test, and repo tooling sources with ESLint.
npm run storybookStart Storybook on port 6006.
npm run build-storybookEmit the static Storybook site to .out/.
npm run site:devStart the GitHub Pages documentation site on http://localhost:4173/.
npm run site:buildBuild the GitHub Pages documentation site into site/dist/.
npm run site:verifyRun site interaction tests, build the Pages app, and verify metadata/output.
npm run typecheckRun the TypeScript check for src, site, scripts, and test.

Published package artifacts are ESM-only. The package exposes main and module via es/index.js and exposes root typings via index.d.ts.

Packaging interop notes

The package ships an ESM-only main/module contract and an exports map for the root entry and shared common components. Generated component-local CSS artifacts are published under es/components and are pulled in by the component modules that need them.

  • Bundlers and TypeScript toolchains should use root named imports such as import { SketchPicker } from '@antonlimar/react-color'.
  • Native Node ESM can resolve the root entry through the package exports map; plain Node execution still needs a CSS-aware loader because picker component modules import CSS side effects.
  • CommonJS require('@antonlimar/react-color') and require('@antonlimar/react-color/lib/...') are no longer supported.

Demo

Demo

Live Demo

Installation & Usage

npm install @antonlimar/react-color

Include the Component

import { SketchPicker } from '@antonlimar/react-color';

function Component() {
  return <SketchPicker />;
}

You can import AlphaPicker BlockPicker ChromePicker CirclePicker CompactPicker GithubPicker GooglePicker HuePicker MaterialPicker PhotoshopPicker SketchPicker SliderPicker SwatchesPicker TwitterPicker respectively.

Styling

The modernization fork ships component-scoped CSS automatically with each component entrypoint instead of relying on default picker UI from inline reactcss styles.

Root picker and shared primitive imports include the CSS they need.

All public pickers keep accepting className on the root node and still support the styles prop for runtime inline overrides. They now also support theme, classNames, and CSS custom properties for styling; new customizations should prefer classNames, CSS variables, and the published rc-* BEM hooks when possible.

版本与发布记录

@antonlimar/react-color 共发布 5 个版本,首次发布于 2026/05/21;过去 12 个月发布了 5 个版本。

版本发布日期距今
3.0.10latest2026/09/251 个月前
3.0.82026/05/255 个月前
3.0.72026/05/235 个月前
3.0.62026/05/215 个月前
3.0.52026/05/215 个月前

关于 @antonlimar/react-color 的常见问题

@antonlimar/react-color 是什么?

A Collection of Color Pickers from Sketch, Photoshop, Chrome & more

如何安装 @antonlimar/react-color?

在项目目录运行 npm install @antonlimar/react-color,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^17.0.0 || ^18.0.0 || ^19.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@antonlimar/react-color 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@antonlimar/react-color 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@antonlimar/react-color 可以商用吗?

@antonlimar/react-color 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@antonlimar/react-color 的下载量有多少?

根据 npm 官方下载统计,@antonlimar/react-color 在 2026/10/06 – 2026/11/04 这 30 天内被下载 4,070 次,日均约 136 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@antonlimar/react-color 还在维护吗?

最新版本 3.0.10 发布于 2026/09/25(1 个月前);至今共发布 5 个版本,其中过去 12 个月发布了 5 个;首次发布于 2026/05/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。