mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-04-24 00:41:52 +02:00
15 lines
471 B
JavaScript
15 lines
471 B
JavaScript
|
/* IMPORT */
|
||
|
import _ from '../utils/index.js';
|
||
|
import Color from '../color/index.js';
|
||
|
/* MAIN */
|
||
|
const adjustChannel = (color, channel, amount) => {
|
||
|
const channels = Color.parse(color);
|
||
|
const amountCurrent = channels[channel];
|
||
|
const amountNext = _.channel.clamp[channel](amountCurrent + amount);
|
||
|
if (amountCurrent !== amountNext)
|
||
|
channels[channel] = amountNext;
|
||
|
return Color.stringify(channels);
|
||
|
};
|
||
|
/* EXPORT */
|
||
|
export default adjustChannel;
|