Convert higher color space to srgb on cmd+c and update it in the clipboard.
npm install clipboard-colorspace-conversionFigma > Preferences > Color Space > Unmanaged.
color() function with which we can represent colors in wider color spaces, when supported. As this feature is decently new we provide a fallback sRGB representation as well, which is gamut mapped as explained above.
shell
$ npm i clipboard-colorspace-conversion
`
Or for CLI usage:
`shell
$ npm i -g clipboard-colorspace-conversion
`
Usage
This library can be used as JS module (= API), as CLI or as a Figma plugin.
$3
$3
The result will be copied to your clipboard if possible and logged to the console.
`shell
ccc
`
color can be any HEX or rgb string copied from somewhere. Here are some examples that work: 0.2, 0.1, 1, 233 100 0, rgb(0, 0, 255), ff00ff, #f0f, #ff00ff00.
An example output would be:
`js
background: rgb(21.596% 9.3558% 100%);
`
$3
`shell
ccc
`
This will watch your clipboard, anything matching a color-code regex (see examples above), will be converted overridden in your clipboard. Whenever this happens a OS level notification will show. Clicking on it will undo the change.
> Notifications depend on node-notifier. Hence the requirements are:
> * macOS: >= 10.8 for native notifications, or Growl if earlier.
> * Linux: notify-osd or libnotify-bin installed (Ubuntu should have this by default)
> * Windows: >= 8, or task bar balloons for Windows < 8. Growl as fallback. Growl takes precedence over Windows balloons.
> * General Fallback: Growl
$3
* --inputColorSpace What is the colorspace of the input (your displays colorspace if the app where you got the color from does not do the conversion). Can be one of these. Defaults to p3 (as in the m1 mbp's display)
$3
For one time usage:
`ts
import clipboardColorspaceConversion from "clipboard-colorspace-conversion"
const colorString = "0.2, 0.1, 1"
const attrb = "background: " // optional
const fromColorSpace = "p3" // optional
const convertedStr = clipboardColorspaceConversion(colorString, attrb, fromColorSpace)
console.log(convertedStr) // 'background: rgb(21.596% 9.3558% 100%);\n' +
// 'background: color(display-p3 0.2 0.1 1);'
``