You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Represents the document styles listed in the Assets panel. Styles can be added and removed manually by the user, so there's no guarantee that these styles are currently used anywhere in the document's content.
3
+
* **Since: ** XD 15
4
+
*/
5
+
export module assets{
6
+
/**
7
+
* Type of gradient color element: linear gradient or radial gradient
8
+
*/
9
+
exportenumGradientType{
10
+
LINEAR,
11
+
RADIAL
12
+
}
13
+
14
+
/**
15
+
* Assets library entry representing a solid color.
16
+
*/
17
+
typeColorAsset={
18
+
/**
19
+
* Name of the Assets entry, if it is explicitly named. (The UI shows an auto-generated label for any unnamed assets).
20
+
*/
21
+
name?: string;
22
+
23
+
/**
24
+
* Color of the asset
25
+
*/
26
+
color: Color;
27
+
}
28
+
29
+
/**
30
+
* Assets library entry representing a linear or radial gradient.
31
+
*/
32
+
typeGradientAsset={
33
+
/**
34
+
* Name of the Assets entry, if it is explicitly named. (The UI shows an auto-generated label for any unnamed assets).
35
+
*/
36
+
name?: string;
37
+
/**
38
+
* Either `GradientType.LINEAR` or `GradientType.RADIAL`
39
+
*/
40
+
gradientType: GradientType;
41
+
/**
42
+
* Array of color stops used in the gradient, where stop >= 0 and <= 1, and the values are strictly increasing. Same format as the colorStops property of a LinearGradientFill object.
43
+
*/
44
+
colorStops: Array<{stop: number,color: Color}>
45
+
}
46
+
47
+
/**
48
+
* Assets library entry representing a set of text character styles.
49
+
*/
50
+
typeCharacterStyleAsset={
51
+
/**
52
+
* Name of the Assets entry, if it is explicitly named. (The UI shows an auto-generated label for any unnamed assets).
53
+
*/
54
+
name?: string;
55
+
/**
56
+
* Object containing the style properties
57
+
*/
58
+
style: CharacterStyle;
59
+
}
60
+
61
+
/**
62
+
* Character style properties. See documentation for the Text node type for more details.
63
+
*/
64
+
typeCharacterStyle={
65
+
/**
66
+
* the font family
67
+
*/
68
+
fontFamily: string;
69
+
/**
70
+
* the style of the font
71
+
*/
72
+
fontStyle: string;
73
+
/**
74
+
* the size of the font
75
+
*/
76
+
fontSize: number;
77
+
/**
78
+
* the Color of the font fill
79
+
*/
80
+
fill: Color;
81
+
/**
82
+
* the character spacing
83
+
*/
84
+
charSpacing: number;
85
+
/**
86
+
* the line spacing
87
+
*/
88
+
lineSpacing: number;
89
+
/**
90
+
* whether underline is turned on
91
+
*/
92
+
underline: boolean;
93
+
}
94
+
95
+
/**
96
+
* The collection of colors and gradients saved in this document's Asset library
97
+
*/
98
+
declarestaticclasscolors{
99
+
/**
100
+
* Get a list of all color/gradient assets, in the order they appear in the Assets panel.
101
+
*
102
+
* The list may contain a mix of solid Color assets and/or gradient assets. If there are no color/gradient assets, an empty array is returned.
* The list may contain a mix of solid Color assets and/or gradient assets. Items are not added if a duplicate color/gradient already exists in the collection, *regardless of its name*.
115
+
* @param colorAssets The color assets
116
+
* @returns {number} number of assets added (may be less than requested if duplicates already exist)
* Delete color/gradient assets from the collection.
122
+
*
123
+
* The list may contain a mix of solid Color assets and/or gradient assets. Assets with the same color/gradient are removed even if their names differ. Assets that already don't exist in the collection are silently ignored. Typically you will pass asset objects returned from `get()` directly to this function.
124
+
*
125
+
* @param colorAssets The color assets
126
+
* @returns {number} number of assets deleted (may be less than requested if some didn't exist)
* Add one or more character style assets to the collection.
149
+
*
150
+
* Items are not added if a duplicate character style already exists in the collection, regardless of its name. All character style properties must be fully specified (no properties are optional).
151
+
*
152
+
* @param charStyleAssets The character style assets
153
+
* @returns {number} number of assets added (may be less than requested if duplicates already exist)
* Delete one or more character style assets from the collection.
159
+
*
160
+
* Assets with the same character style are removed even if their names differ. Assets that already don't exist in the collection are silently ignored. All character style properties must be fully specified (no properties are optional). Typically you will pass asset objects returned from `get()` directly to this function.
161
+
*
162
+
* @returns {number} number of assets deleted (may be less than requested if some didn't exist)
0 commit comments