File size: 500 Bytes
bc20498
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

/* IMPORT */

import Color from '~/color';
import change from '~/methods/change';
import type {CHANNELS, Channels} from '~/types';

/* MAIN */

const adjust = ( color: string | Channels, channels: Partial<CHANNELS> ): string => {

  const ch = Color.parse ( color );
  const changes: Partial<CHANNELS> = {};

  for ( const c in channels ) {

    if ( !channels[c] ) continue;

    changes[c] = ch[c] + channels[c];

  }

  return change ( color, changes );

};

/* EXPORT */

export default adjust;