How to use the postcss-values-parser.paren function in postcss-values-parser

To help you get started, we’ve selected a few postcss-values-parser 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 postcss / postcss-color-hex-alpha / index.js View on Github external
parseInt(hex8.slice(6, 8), 16),
		Math.round(parseInt(hex8.slice(8, 10), 16) / 255 * alphaDecimalPrecision) / alphaDecimalPrecision
	];

	// return a new rgba function, preserving the whitespace of the original node
	const rgbaFunc = valueParser.func({ value: 'rgba', raws: Object.assign({}, node.raws) });

	rgbaFunc.append(valueParser.paren({ value: '(' }));
	rgbaFunc.append(valueParser.number({ value: r }));
	rgbaFunc.append(valueParser.comma({ value: ',' }));
	rgbaFunc.append(valueParser.number({ value: g }));
	rgbaFunc.append(valueParser.comma({ value: ',' }));
	rgbaFunc.append(valueParser.number({ value: b }));
	rgbaFunc.append(valueParser.comma({ value: ',' }));
	rgbaFunc.append(valueParser.number({ value: a }));
	rgbaFunc.append(valueParser.paren({ value: ')' }));

	return rgbaFunc;
};