Files
Shifted/node_modules/polished/lib/internalHelpers/_reduceHexValue.js.flow
2026-02-10 01:14:19 +00:00

20 lines
360 B
Plaintext

// @flow
/**
* Reduces hex values if possible e.g. #ff8866 to #f86
* @private
*/
const reduceHexValue = (value: string): string => {
if (
value.length === 7
&& value[1] === value[2]
&& value[3] === value[4]
&& value[5] === value[6]
) {
return `#${value[1]}${value[3]}${value[5]}`
}
return value
}
export default reduceHexValue