import Utils from '../utils/index.mjs';
import Color from '../color/index.mjs';

/* IMPORT */
/* MAIN */
const adjustChannel = (color, channel, amount) => {
    const channels = Color.parse(color);
    const amountCurrent = channels[channel];
    const amountNext = Utils.channel.clamp[channel](amountCurrent + amount);
    if (amountCurrent !== amountNext)
        channels[channel] = amountNext;
    return Color.stringify(channels);
};

export { adjustChannel as default };
