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.
vanilla-picker-mini
Advanced tools
Readme
A simple, easy to use color picker with alpha selection.
This is a smaller version of vanilla-picker 2.5.0, made for submission to the MicroJS.com catalog.
The only difference from the full version is the lack of support for color names. This means you need to set the picker's color values in hex
/rgba
/hsla
notation, and not "red", "yellowgreen" or "mediumaquamarine".
https://codepen.io/Sphinxxxx/pen/xazoQN
Download vanilla-picker-mini.js
from the /dist
folder, or use a CDN:
<script src="https://unpkg.com/vanilla-picker-mini@1"></script>
<div id="parent">Click me</div>
<script>
/*
Create a new Picker instance and set the parent element.
By default, the color picker is a popup which appears when you click the parent.
*/
var parent = document.querySelector('#parent');
var picker = new Picker(parent);
/*
You can do what you want with the chosen color using two callbacks: onChange and onDone.
*/
picker.onChange = function(color) {
parent.style.background = color.rgbaString();
};
/* onDone is similar to onChange, but only called when you click 'Ok' */
</script>
var picker = new Picker({
parent: /* Which element the picker should be attached to */
/* If the picker is used as a popup, where to place it relative to the parent */
popup: 'right' //Default
'left'
'top'
'bottom'
false //No popup, just add the picker as a normal child element of the parent
template: /* Custom HTML string from which to build the picker. See /src/picker.pug for required elements and class names */
layout: 'default' /* Suffix of a custom "layout_..." CSS class to handle the overall arrangement of the picker elements */
alpha: true /* Whether to enable adjusting the alpha channel */
editor: true /* Whether to show a text field for color value editing */
color: /* Initial color for the picker (or call picker.setColor()) */
onChange: /* Callback whenever the color changes (or set picker.onChange) */
onDone: /* Callback when the user clicks "Ok" (or set picker.onDone) */
onOpen: /* Callback when the popup opens (or set picker.onOpen) */
onClose: /* Callback when the popup closes (or set picker.onClose) */
});
The color picker is built to support basic keyboard navigation and use with screen readers. I would be very interested in feedback on improvements that could be done here!
The ISC license - see the LICENSE.md file for details.
FAQs
A simple, easy to use color picker with alpha selection.
The npm package vanilla-picker-mini receives a total of 17 weekly downloads. As such, vanilla-picker-mini popularity was classified as not popular.
We found that vanilla-picker-mini 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.