Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@tiagotrindade/solid-colorful
Advanced tools
🎨 A tiny (2,8 KB) color picker component for SolidJS apps. Fast, well-tested, dependency-free, mobile-friendly and accessible
npm install solid-colorful
import { HexColorPicker } from "solid-colorful"
const YourComponent = () => {
const [color, setColor] = useState("#aabbcc")
return <HexColorPicker color={color} onChange={setColor} />
}
We provide 12 additional color picker components for different color models, unless your app needs a HEX string as an input/output format.
Import | Value example |
---|---|
{ HexColorPicker } | "#ffffff" |
{ RgbColorPicker } | { r: 255, g: 255, b: 255 } |
{ RgbaColorPicker } | { r: 255, g: 255, b: 255, a: 1 } |
{ RgbStringColorPicker } | "rgb(255, 255, 255)" |
{ RgbaStringColorPicker } | "rgba(255, 255, 255, 1)" |
{ HslColorPicker } | { h: 0, s: 0, l: 100 } |
{ HslaColorPicker } | { h: 0, s: 0, l: 100, a: 1 } |
{ HslStringColorPicker } | "hsl(0, 0%, 100%)" |
{ HslaStringColorPicker } | "hsla(0, 0%, 100%, 1)" |
{ HsvColorPicker } | { h: 0, s: 0, v: 100 } |
{ HsvaColorPicker } | { h: 0, s: 0, v: 100, a: 1 } |
{ HsvStringColorPicker } | "hsv(0, 0%, 100%)" |
{ HsvaStringColorPicker } | "hsva(0, 0%, 100%, 1)" |
import { RgbColorPicker } from "solid-colorful"
const YourComponent = () => {
const [color, setColor] = createSignal({ r: 50, g: 100, b: 150 })
return <RgbColorPicker color={color} onChange={setColor} />
}
The easiest way to tweak solid-colorful is to create another stylesheet to override the default styles.
.your-component .solid-colorful {
height: 240px;
}
.your-component .solid-colorful__saturation {
border-radius: 4px 4px 0 0;
}
.your-component .solid-colorful__hue {
height: 40px;
border-radius: 0 0 4px 4px;
}
.your-component .solid-colorful__hue-pointer {
width: 12px;
height: inherit;
border-radius: 0;
}
As you probably noticed the color picker itself does not include an input field, but do not worry if you need one. solid-colorful is a modular library that allows you to build any picker you need. Since v2.1
we provide an additional component that works perfectly in pair with our color picker.
HexColorInput
import { HexColorPicker, HexColorInput } from "solid-colorful"
const YourComponent = () => {
const [color, setColor] = useState("#aabbcc")
return (
<div>
<HexColorPicker color={color} onChange={setColor} />
<HexColorInput color={color} onChange={setColor} />
</div>
)
}
Property | Default | Description |
---|---|---|
alpha | false | Allows #rgba and #rrggbbaa color formats |
prefixed | false | Enables # prefix displaying |
HexColorInput
does not have any default styles, but it also accepts all properties that a regular input
tag does (such as class
, placeholder
and autoFocus
). That means you can place and modify this component as you like. Also, that allows you to combine the color picker and input in different ways:
<HexColorInput color={color} onChange={setColor} placeholder="Type a color" prefixed alpha />
solid-colorful supports TypeScript and ships with types in the library itself; no need for any other install.
While not only typing its own functions and variables, it can also help you type yours. Depending on the component you are using, you can also import the type that is associated with the component. For example, if you are using our HSL color picker component, you can also import the HSL
type.
import { HslColorPicker, HslColor } from "solid-colorful";
const myHslValue: HslColor = { h: 0, s: 0, l: 0 };
Take a look at Supported Color Models for more information about the types and color formats you may want to use.
It would be an easier task to list all of the browsers and versions that solid-colorful does not support! We regularly test against browser versions going all the way back to 2013 and this includes IE11.
solid-colorful works out-of-the-box for most browsers, regardless of version, and only requires an Object.assign
polyfill be provided for full IE11 support.
Today each dependency drags more dependencies and increases your project’s bundle size uncontrollably. But size is very important for everything that intends to work in a browser.
solid-colorful is a simple color picker for those who care about their bundle size and client-side performance. It is fast and lightweight because:
To show you the problem that solid-colorful is trying to solve, we have performed a simple benchmark (using bundlephobia.com) against popular React color picker libraries:
Name | Bundle size | Bundle size (gzip) | Dependencies |
---|---|---|---|
solid-colorful | |||
solid-color | |||
solid-input-color | |||
rc-color-picker |
FAQs
🎨 A tiny (2,8 KB) color picker component for SolidJS apps. Fast, well-tested, dependency-free, mobile-friendly and accessible
The npm package @tiagotrindade/solid-colorful receives a total of 8 weekly downloads. As such, @tiagotrindade/solid-colorful popularity was classified as not popular.
We found that @tiagotrindade/solid-colorful 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.