Socket
Book a DemoInstallSign in
Socket

simple-color-palette

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-color-palette

A JavaScript implementation of the Simple Color Palette format — a minimal JSON-based file format for defining color palettes

latest
Source
npmnpm
Version
0.2.1
Version published
Maintainers
1
Created
Source

simple-color-palette

A JavaScript implementation of the Simple Color Palette format — a minimal JSON-based file format for defining color palettes

Feedback wanted on the API.

Install

npm install simple-color-palette

Usage

import ColorPalette from 'simple-color-palette';

const redColor = new ColorPalette.Color({
	name: 'Red',
	red: 1,
	green: 0,
	blue: 0,
});

const greenColor = new ColorPalette.Color({
	name: 'Green',
	red: 0,
	green: 1,
	blue: 0,
});

const palette = new ColorPalette({
	name: 'Traffic Lights',
	colors: [
		redColor,
		greenColor
	],
});

console.log(redColor.components);
// {red: 1, green: 0, blue: 0, opacity: 1}

// Modify color components
redColor.red = 0.9;

// Serialize to string
const serialized = palette.serialize();

// Load from serialized data
const loadedPalette = ColorPalette.deserialize(serialized);

API

See types.

Note

The palette operates in non-linear sRGB, while the serialized version is in linear (gamma-corrected) sRGB for precision.

Keywords

color

FAQs

Package last updated on 19 Oct 2025

Did you know?

Socket

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.

Install

Related posts