-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathspotcolor.js
More file actions
45 lines (44 loc) · 1.06 KB
/
spotcolor.js
File metadata and controls
45 lines (44 loc) · 1.06 KB
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
export default class SpotColor {
constructor(doc, name, C, M, Y, K) {
if (typeof K === 'undefined') {
this.id = 'CS' + Object.keys(doc.spotColors).length;
this.name = name;
this.values = [C, M, Y];
this.ref = doc.ref([
'Separation',
this.name,
'DeviceRGB',
{
Range: [0, 1, 0, 1, 0, 1],
C0: [0, 0, 0],
C1: this.values.map((value) => value / 255),
FunctionType: 2,
Domain: [0, 1],
N: 1,
},
]);
this.ref.end();
} else {
this.id = 'CS' + Object.keys(doc.spotColors).length;
this.name = name;
this.values = [C, M, Y, K];
this.ref = doc.ref([
'Separation',
this.name,
'DeviceCMYK',
{
Range: [0, 1, 0, 1, 0, 1, 0, 1],
C0: [0, 0, 0, 0],
C1: this.values.map((value) => value / 100),
FunctionType: 2,
Domain: [0, 1],
N: 1,
},
]);
this.ref.end();
}
}
toString() {
return `${this.ref.id} 0 R`;
}
}