![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
procreate-swatches
Advanced tools
Read and create Procreate .swatches
palette files.
npm install procreate-swatches
import { readSwatchesFile, createSwatchesFile } from 'procreate-swatches';
// Node.js
import { promises as fs } from 'fs';
(async () => {
const data = await fs.readFile('path/to/palette.swatches');
const swatches = readSwatchesFile(data);
})();
// Browser
(async () => {
const response = await fetch('path/to/palette.swatches');
const data = await response.arrayBuffer();
const swatches = readSwatchesFile(data);
})();
// Creating a .swatches file
(async () => {
const swatchesFile = createSwatchesFile('My Palette', [
['rgb', [255,0,0]],
['rgb', [0,255,0]],
['rgb', [0,0,255]]
]);
console.log(swatchesFile); // ArrayBuffer
})();
This module is also available as commonjs
:
const { readSwatchesFile, createSwatchesFile } = require('procreate-swatches/cjs');
Reads the contents of a Procreate .swatches
file and optionally converts the parsed colors to a different color space.
Arguments:
base64
, text
, binarystring
, array
, uint8array
, arraybuffer
, blob
, nodebuffer
string
- optional, the color space to convert the parsed colors to, defaults to hsv
. Procreate stores swatches in HSB (an alias of HSV), so if you leave the second argument blank they will stay that way. Supported color spaces: rgb
, hsl
, hsv
, hwb
, xyz
, lab
, lch
.Returns:
object
- a plain object containing two properties:
string
- the name of the parsed palettearray
- containing colors from the palette as arrays
in the format [[...colorValues], colorSpace]
, i.e. ['rgb', [255,255,255]]
. Some elements of the colors array may be null
, indicating an empty spot in the palette.Throws:
ProcreateSwatchesError
- if the file is not a valid .swatches
file, or if the requested color space is not supportedCreates a new Procreate .swatches
file.
Arguments:
string
- the name of the palettearray
- containing the colors to be included in the palette, in the format [colorSpace, [...colorValues]]
, i.e. ['rgb', [255,255,255]]
(spaces other than hsv
will be converted). You may also include null
to create an empty spot in the palette. A Procreate palette may only contain 30 colors, any more will be ignored.string
- the format to return the created file in. Supported formats: base64
, text
, binarystring
, array
, uint8array
, arraybuffer
, blob
, nodebuffer
Returns:
arraybuffer
- raw contents of the created .swatches
fileThrows:
TypeError
- if the provided name
is not a string, or if colors
are not an array following the format [[...colorValues], colorSpace]
ProcreateSwatchesError
- if the color space of a color is not supported, or if the color is not validMIT License
Copyright (c) 2021 Kamil Szydlowski kamil.szydlovski@gmail.com (http://www.szydlovski.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
read and create Procreate .swatches files
The npm package procreate-swatches receives a total of 0 weekly downloads. As such, procreate-swatches popularity was classified as not popular.
We found that procreate-swatches 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.