Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
react-eyedrop
Advanced tools
Readme
A highly customizable, fully typed & tested color eye-dropper for your React project.
Yarn:
yarn add react-eyedrop
NPM:
npm install --save react-eyedrop
required
function
{ rgb: string, hex: string, customProps: object }
Example:
function onChange({ rgb, hex }) {
/* Do stuff */
}
<!-------->
<EyeDropper onChange={onChange} />
string
Example:
<EyeDropper wrapperClasses="my-css-class" />
/* or even */
<EyeDropper wrapperClasses={`my-css-class ${active ? 'my-active-css-class' : ''}`} />
string
Example:
<EyeDropper buttonClasses="my-css-class" />
/* or even */
<EyeDropper buttonClasses={`my-css-class ${active ? 'my-active-css-class' : ''}`} />
React Node
onClick
prop which gets passed down.Example:
const Button = ({ onClick }) =>
<button className="btn" onClick={onClick} >My custom button</button>
<!-------->
<EyeDropper customComponent={Button} />
object
Example:
const onChange = ({ rgb, hex, customProps }) => {
const { data1, data2, } = customProps
}
<!-------->
<Eyedropper customComponent={Button} customProps={{data1, data2, data3}} onChange={onChange}/>
string
Example:
const Button = ({ onClick, pixelColors }) =>
<button className="btn" onClick={onClick} style={{backgroundColor: pixelColors.hex}}>My custom button</button>
<!-------->
<EyeDropper customComponent={Button} colorsPassThrough='pixelColors' />
boolean
Example:
const Button = ({ onClick, disabled }) =>
<button className="btn" onClick={onClick} disabled={disabled} >My custom button</button>
boolean
true
false
-> true
during runtime)Example:
<EyeDropper once />
/* or */
<EyeDropper once={false} />
number
0-450
Example:
<EyeDropper pickRadius={1} />
string
copy
Example:
<EyeDropper cursorActive="cursor" />
string
auto
Example:
<EyeDropper cursorActive="auto" />
function
Example:
function getPeanut() {
console.log('Mmm... Definately overrated.')
}
<!-------->
<EyeDropper onInit={getPeanut} />
/* Will be called when component is mounted */
function
Example:
function getBananas() {
console.log('Ahhh... Much better.')
}
<!-------->
<EyeDropper onPickStart={getBananas} />
/* Will be called when starting to EyeDrop */
function
Example:
function buyBurritos() {
console.log('Yum!')
}
<!-------->
<EyeDropper onPickEnd={buyBurritos} />
/* Will be called when you finish EyeDropping */
colors
will contain whatever is clicked once pickColor
is called.
Call cancelPickColor
to stop picking colors. :zany_face:
Example:
import { useEyeDrop } from 'react-eyedrop'
const [colors, pickColor, cancelPickColor] = useEyeDrop({
once: boolean,
pickRadius: number,
cursorActive: CSS Cursors,
cursorInactive: CSS Cursors,
onPickStart?: () => void
onPickEnd?: () => void
onPickCancel?: () => void
})
Run the unit tests locally:
npm i
/* or */
yarn
/* and then */
npm run test
onPickEnd
propertyonPickEnd
since same functionality can be achieved with handleChangeimg
tags on the DOMpickRadius
feature to work with different units; radius & pixel.pickRadius
featurebuttonComponent
to customComponent
Manjodh "Mango" Singh – manjodheriksingh@gmail.com
Distributed under the MIT license. See license for more information.
git checkout -b feature/fooBar
)git commit -am 'Add some fooBar'
)git push origin feature/fooBar
)FAQs
A reusable ColorPick EyeDropper written in React & TypeScript.
The npm package react-eyedrop receives a total of 1,048 weekly downloads. As such, react-eyedrop popularity was classified as popular.
We found that react-eyedrop demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.