2 Star 3 Fork 1

uiw / react-color

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT




@uiw/react-color



React Color

react-color is a tiny color picker widget component for React apps. These components can be installed and used separately.



@uiw/react-color



Getting Started

npm i @uiw/react-color

Open in CodeSandbox Open in Github gh-pages

import { Slider, Sketch, Material, Colorful, Compact, Circle, Wheel, Block, Github, Chrome } from '@uiw/react-color';
import { Alpha, Hue, ShadeSlider, Saturation, Interactive, hsvaToHslaString } from '@uiw/react-color';
import { EditableInput, EditableInputRGBA, EditableInputHSLA } from '@uiw/react-color';

function Demo() {
  const [hex, setHex] = useState("#fff");
  return (
    <Sketch
      style={{ marginLeft: 20 }}
      color={hex}
      onChange={(color) => {
        setHex(color.hex);
      }}
    />
  );
}

Support dark/night Theme

[data-color-mode*='dark'] .w-color-sketch {
  --sketch-background: #323232 !important;
}

[data-color-mode*='dark'] .w-color-swatch {
  --sketch-swatch-border-top: 1px solid #525252 !important;
}

[data-color-mode*='dark'] .w-color-block {
  --block-background-color: #323232 !important;
  --block-box-shadow: rgb(0 0 0 / 10%) 0 1px !important;
}

[data-color-mode*='dark'] .w-color-editable-input {
  --editable-input-label-color: #757575 !important;
  --editable-input-box-shadow: #616161 0px 0px 0px 1px inset !important;
  --editable-input-color: #bbb !important;
}

[data-color-mode*='dark'] .w-color-github {
  --github-border: 1px solid rgba(0, 0, 0, 0.2) !important;
  --github-background-color: #323232 !important;
  --github-box-shadow: rgb(0 0 0 / 15%) 0px 3px 12px !important;
  --github-arrow-border-color: rgba(0, 0, 0, 0.15) !important;
}

[data-color-mode*='dark'] .w-color-compact {
  --compact-background-color: #323232 !important;
}

[data-color-mode*='dark'] .w-color-material {
  --material-background-color: #323232 !important;
  --material-border-bottom-color: #707070 !important;
}

[data-color-mode*='dark'] .w-color-alpha {
  --alpha-pointer-background-color: #6a6a6a !important;
  --alpha-pointer-box-shadow: rgb(0 0 0 / 37%) 0px 1px 4px 0px !important;
}

Documentation

You can find the react-color documentation on the website.

Packages

Package Bundle size(gzip) Downloads Version / unpkg
@uiw/react-color npm bundle size npm bundle size npm downloads npm version Open in unpkg
@uiw/react-color-sketch bundle size bundle size(gzip) npm downloads npm version Open in unpkg
@uiw/react-color-slider bundle size bundle size(gzip) npm downloads npm version Open in unpkg
@uiw/react-color-compact bundle size bundle size(gzip) npm downloads npm version Open in unpkg
@uiw/react-color-material bundle size bundle size(gzip) npm downloads npm version Open in unpkg
@uiw/react-color-colorful bundle size bundle size(gzip) npm downloads npm version Open in unpkg
@uiw/react-color-wheel bundle size bundle size(gzip) npm downloads npm version Open in unpkg
@uiw/react-color-circle bundle size bundle size(gzip) npm downloads npm version Open in unpkg
@uiw/react-color-block bundle size bundle size(gzip) npm downloads npm version Open in unpkg
@uiw/react-color-chrome bundle size bundle size(gzip) npm downloads npm version Open in unpkg
@uiw/react-color-github bundle size bundle size(gzip) npm downloads npm version Open in unpkg

Base Components

Package Bundle size(gzip) Downloads Version / unpkg
@uiw/react-color-saturation bundle size bundle size(gzip) npm downloads npm version Open in unpkg
@uiw/react-color-hue bundle size bundle size(gzip) npm downloads npm version Open in unpkg
@uiw/react-color-alpha bundle size bundle size(gzip) npm downloads npm version Open in unpkg
@uiw/react-color-swatch bundle size bundle size(gzip) npm downloads npm version Open in unpkg
@uiw/react-color-shade-slider bundle size bundle size(gzip) npm downloads npm version Open in unpkg
@uiw/react-color-editable-input bundle size bundle size(gzip) npm downloads npm version Open in unpkg
@uiw/react-color-editable-input-rgba bundle size bundle size(gzip) npm downloads npm version Open in unpkg
@uiw/react-color-editable-input-hsla bundle size bundle size(gzip) npm downloads npm version Open in unpkg
@uiw/react-drag-event-interactive bundle size bundle size(gzip) npm downloads npm version Open in unpkg
@uiw/color-convert bundle size bundle size(gzip) npm downloads npm version Open in unpkg
@uiw/react-color-name bundle size bundle size(gzip) npm downloads npm version Open in unpkg

Development

npm install       # Installation dependencies
npm run build     # Compile all package
cd packages/color-block
# listen to the component compile and output the .js file
# listen for compilation output type .d.ts file
npm run watch # Monitor the compiled package `@uiw/react-block`
npm run start     # development mode, listen to compile preview website instance

Contributors

As always, thanks to our amazing contributors!

Made with contributors.

License

Licensed under the MIT License.

MIT License Copyright (c) 2021 uiw Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

🎨 是一个用于 React 应用程序的小型颜色选择器小部件组件。 展开 收起
TypeScript 等 4 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
TypeScript
1
https://gitee.com/uiw/react-color.git
git@gitee.com:uiw/react-color.git
uiw
react-color
react-color
main

搜索帮助