uiwjs / react-color Goto Github PK
View Code? Open in Web Editor NEW🎨 Is a tiny color picker widget component for React apps.
Home Page: https://uiwjs.github.io/react-color
License: MIT License
🎨 Is a tiny color picker widget component for React apps.
Home Page: https://uiwjs.github.io/react-color
License: MIT License
In the GithubPlacement
enum there is a typo the word "Bottom" in several combinations.
export enum GithubPlacement {
Left = 'L',
LeftTop = 'LT',
LeftBotton = 'LB',
Right = 'R',
RightTop = 'RT',
RightBotton = 'RB',
Top = 'T',
TopRight = 'TR',
TopLeft = 'TL',
Botton = 'B',
BottonLeft = 'BL',
BottonRight = 'BR',
}
Not sure if you want to change this as it would mean a API breaking change. You could add the correctly spelled keys mapping to the same string values though.
Could you please add an option to disable alpha for Sketch picker? Alpha doesn't make sense if you work with hex codes because it requires an 8 character hex code format instead of 6 character format which is used by default
Hi,
I'm trying to bundle a project using @uiw/color-convert
package, but I get the Circular dependencies
error.
(!) Circular dependencies
node_modules/@uiw/color-convert/esm/index.js -> node_modules/@uiw/color-convert/esm/utils.js -> node_modules/@uiw/color-convert/esm/index.js
node_modules/@uiw/color-convert/esm/index.js -> node_modules/@uiw/color-convert/esm/getContrastingColor.js -> node_modules/@uiw/color-convert/esm/index.js
Anyone had any issue like that? Trying to find out if it's a bug or am I doing something wrong.
Thanks
Issue is reproducible both in code and on the live demo site: https://uiwjs.github.io/react-color/#/colorful
This occurs for several other demo pickers on the site, making this unusable in my projects. This is occurring in Chrome.
Is it possible to implement direction="vertical"?
I see Colorful can use hex; is there a way we can implement hex with the Wheel component instead of hsva? Really great tools! Thanks.
Uncaught TypeError: Cannot redefine property: render
at Function.defineProperty (<anonymous>)
at <unknown> (file:///..../app/node_modules/@uiw/react-color/cjs/index.js:188:10)
NextJS (tried to turn off SSR, checked for window
variable etc) - no difference. Do you have any advises here? Thank you in advance
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are pending. To force PRs open, click the checkbox below.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
@types/react
, @types/react-dom
, react
, react-dom
, react-test-renderer
).github/workflows/ci.yml
actions/checkout v4
actions/setup-node v4
peaceiris/actions-gh-pages v4
ncipollo/release-action v1
.github/workflows/pr.yml
actions/checkout v3
actions/setup-node v3
package.json
@kkt/less-modules ^7.2.0
@kkt/ncc ^1.0.13
@testing-library/react ^14.0.0
@types/react ~18.2.0
@types/react-dom ~18.2.0
@types/react-test-renderer ~18.0.0
husky ~9.0.0
jest ^29.5.0
jest-environment-jsdom ^29.5.0
jest-watch-typeahead ^2.2.2
lerna ^8.0.0
lint-staged ^15.1.0
prettier ^3.0.0
react ~18.2.0
react-dom ~18.2.0
react-test-renderer ~18.2.0
tsbb ^4.1.0
node >=16.0.0
packages/color-alpha/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
react >=16.9.0
react-dom >=16.9.0
packages/color-block/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
react >=16.9.0
react-dom >=16.9.0
packages/color-chrome/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
react >=16.9.0
react-dom >=16.9.0
packages/color-circle/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
react >=16.9.0
react-dom >=16.9.0
packages/color-colorful/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
react >=16.9.0
react-dom >=16.9.0
packages/color-compact/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
react >=16.9.0
react-dom >=16.9.0
packages/color-convert/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
packages/color-editable-input-hsla/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
react >=16.9.0
react-dom >=16.9.0
packages/color-editable-input-rgba/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
react >=16.9.0
react-dom >=16.9.0
packages/color-editable-input/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
react >=16.9.0
react-dom >=16.9.0
packages/color-github/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
react >=16.9.0
react-dom >=16.9.0
packages/color-hue/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
react >=16.9.0
react-dom >=16.9.0
packages/color-material/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
react >=16.9.0
react-dom >=16.9.0
packages/color-name/package.json
colors-named ^1.0.1
colors-named-hex ^1.0.1
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
packages/color-saturation/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
react >=16.9.0
react-dom >=16.9.0
packages/color-shade-slider/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
react >=16.9.0
react-dom >=16.9.0
packages/color-sketch/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
react >=16.9.0
react-dom >=16.9.0
packages/color-slider/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
react >=16.9.0
react-dom >=16.9.0
packages/color-swatch/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
react >=16.9.0
react-dom >=16.9.0
packages/color-wheel/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
react >=16.9.0
react-dom >=16.9.0
packages/color/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
react >=16.9.0
react-dom >=16.9.0
packages/drag-event-interactive/package.json
@babel/runtime ^7.21.0
@babel/runtime >=7.19.0
react >=16.9.0
react-dom >=16.9.0
website/package.json
@babel/runtime ^7.21.0
@uiw/react-github-corners ~1.5.3
@uiw/react-loader ^4.22.2
@uiw/react-markdown-preview-example ^2.0.0
@wcj/dark-mode ^1.0.14
react ~18.2.0
react-dom ~18.2.0
react-router-dom ^6.20.0
@kkt/less-modules ^7.2.0
@kkt/raw-modules ^7.2.0
@types/react ~18.2.0
@types/react-dom ~18.2.0
kkt ^7.2.0
markdown-react-code-preview-loader ^2.1.2
I try to drag pointer of on Colorful
component on mobile device, but nothing happens. You may try it on your live-demo site from your phone https://uiwjs.github.io/react-color/#/colorful
It would be very nice to be able to pass a prop to the color picker to remove the alpha slider when I want to restrict the possible value selected to RGB, not RGBA. If the ability already exists, I have not managed to find it in the documentation.
I'm thinking it would work something like:
<Colorful disableAlpha='true' />
Hello. I tried to customize the wheel by setting direction
and angle
but they just change the visualization of the background, both the Pointer color and onChange ColorResult
still use the "original" color (with default direction="anticlockwise"
and angle=180
).
Am I missing something?
In my opinion the shade slider is not working properly. For the color #ffffff, the range is always from red to black. It seems to me that the saturation should not be permanently 100. Correction suggestion:
import { hsvaToHslaString } from '@uiw/color-convert'
import Alpha, { AlphaProps } from '@uiw/react-color-alpha'
import React from 'react'
export interface ShadeSliderProps extends Omit<AlphaProps, 'onChange'> {
onChange?: (newShade: { v: number }) => void
}
export const ShadeSlider = React.forwardRef<HTMLDivElement, ShadeSliderProps>(
(props, ref) => {
const {
prefixCls = 'w-color-saturation',
className,
onChange,
direction = 'horizontal',
hsva,
...other
} = props
const colorFrom = hsvaToHslaString({ ...hsva, a: 1, v: 100 })
return (
<Alpha
ref={ref}
{...other}
className={`${prefixCls} ${className || ''}`}
hsva={{ h: hsva.h, s: hsva.s, v: hsva.v, a: 1 - hsva.v / 100 }}
direction={direction}
background={`linear-gradient(to ${
direction === 'horizontal' ? 'right' : 'bottom'
}, ${colorFrom}, rgb(0, 0, 0))`}
onChange={(_, interaction) => {
onChange &&
onChange({
v:
direction === 'horizontal'
? 100 - interaction.left * 100
: 100 - interaction.top * 100,
})
}}
/>
)
},
)
add a type for hex-color strings that is a bit stricter than only string
.
type HexColor = `#${string}`;
Currently, there are parameters to pass the color value, every time that value is changed the color will reset itself to that value.
Can we also have the option to have a default color value? A value that is only present until the user changes the color.
I would appreciate this feature. Thanks!
Could Swatches support a null color swatch to unset the color?
I've used code like this:
const [hsva, setHsva] = useState({ h: 214, s: 43, v: 90, a: 1 })
const onChangeColorPicker = (event: any) => {
setHsva({ ...hsva, ...event.hsva })
}
return (
<Wheel className={"wheel"} color={hsva} onChange={(event) => onChangeColorPicker(event)} />
)
At times, when I simply click (not click, hold, and move) on the wheel, the color doesn't update immediately. I find that I have to click on the same spot again to trigger the onChange event.
Do I need to use another approach?
https://github.com/uiwjs/react-color/blob/main/packages/color-convert/src/index.ts#L208C28-L208C28
hexToRgab('#00000000') ===> { r:0, g: 0, b: 0, a: 1 }
fix: =>>>>. (a ?? 255) / RGB_MAX
What happens:
For the wheel component, if the color is set to '#000000', then the cursor is immovable
What should happen:
The cursor should be able to move round the wheel and maybe capture all essence of black
Chrome's actual color picker widget has an eye dropper to let you pick any color. Chrome actually has an API to let you easily add that functionality https://developer.mozilla.org/en-US/docs/Web/API/EyeDropper - although it won't work in any other browsers, unfortunately. Might still be worth adding, you can do feature detection to decide whether to show it or not.
I'm using @uiw/react-color-wheel latest version (1.0.2
) on one of my React JS projects. I need to customize the pointer element. So basically pointer props (color, left, right) will be enough for my implementation. But the problem is the pointer doesn't fit within the wheel element and pointer props are always the same when changing.
Tried with the default Pointer as well. But the result remains the same.
Pointer preview
Pointer props
color: ""
left: "0"
prefixCls: "w-color-wheel"
top: "0"
Source code
Is there any slider I can use to change v for hsva wheel?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.