How to use the culori.round function in culori

To help you get started, we’ve selected a few culori examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Evercoder / uiuiui / src / ColorPicker / ColorPicker.js View on Github external
value: 'rgba(255, 0, 0, 1)',
	onChange: noop,
	onStart: noop,
	onEnd: noop,
	reactive: false
};

/*
	Utilities
	-----------------------------------------------------------------
 */

const toWhite = color => [color, 'white'];
const toBlack = color => [color, 'black'];

const roundi = culoriRound(0);
const _css = culoriFormatter();

const extract_hsba = color => {
	let hsba = culoriHsv(color);
	let ret = {};
	if (!hsba) return ret;
	if (hsba.h !== undefined) ret['hue'] = hsba.h;
	if (hsba.s !== undefined) ret['saturation'] = hsba.s * 100;
	if (hsba.v !== undefined) ret['brightness'] = hsba.v * 100;
	if (hsba.alpha !== undefined) {
		ret['opacity'] = roundi(hsba.alpha * 100);
	} else {
		ret['opacity'] = 100;
	}
	return ret;
};

culori

A general-purpose color library for JavaScript

MIT
Latest version published 3 months ago

Package Health Score

89 / 100
Full package analysis