-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShadeGenerator.js
More file actions
49 lines (34 loc) · 749 Bytes
/
ShadeGenerator.js
File metadata and controls
49 lines (34 loc) · 749 Bytes
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const mix = function mix(color_1,color_2 = [0,0,0],width = 0.5){
let f = color_1.map((x) => {
return width * x;
},[]);
let g = color_2.map((x) => {
return (1 - width) * x;
});
let h = f.map((value,key) => {
return value + g[key];
});
return h;
};
const shade= function shade(color, weight = 0.5)
{
let t = color;
let u = mix(t, [0, 0, 0], weight);
return u;
};
const tint = function tine(color , wieght){
let t = color;
let u = mix(t,[255,255,255],wieght);
return u;
};
const tone = function tone(color,wieght){
let t = color;
let u = mix(t,[128,128,128],wieght);
return u;
};
module.exports = {
tone,
tint,
mix,
shade
};