Skip to content
Permalink
main
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
import parseToHsla from './parseToHsla';
import hsla from './hsla';
/**
* Desaturates the input color by the given amount via subtracting from the `s`
* in `hsla`.
*
* @param amount The amount to desaturate, given as a decimal between 0 and 1
*/
function desaturate(color: string, amount: number): string {
const [h, s, l, a] = parseToHsla(color);
return hsla(h, s - amount, l, a);
}
export default desaturate;