procreate-swatches 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.codeclimate.yml +7 -0
- data/.gitignore +16 -0
- data/.rspec +2 -0
- data/.rubocop.yml +8 -0
- data/.ruby-version +1 -0
- data/.travis.yml +19 -0
- data/.yardopts +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +102 -0
- data/LICENSE.txt +21 -0
- data/README.md +230 -0
- data/Rakefile +8 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/doc/Procreate/Swatches/ColorsHelper.html +693 -0
- data/doc/Procreate/Swatches/Errors/InvalidFormat.html +220 -0
- data/doc/Procreate/Swatches/Errors/InvalidPath.html +220 -0
- data/doc/Procreate/Swatches/Errors.html +128 -0
- data/doc/Procreate/Swatches/Exporter.html +754 -0
- data/doc/Procreate/Swatches/Parser.html +622 -0
- data/doc/Procreate/Swatches/Wrapper.html +1168 -0
- data/doc/Procreate/Swatches.html +497 -0
- data/doc/Procreate.html +128 -0
- data/doc/_index.html +209 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +496 -0
- data/doc/file.CODE_OF_CONDUCT.html +146 -0
- data/doc/file.LICENSE.html +70 -0
- data/doc/file.README.html +296 -0
- data/doc/file_list.html +66 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +296 -0
- data/doc/js/app.js +292 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +275 -0
- data/doc/top-level-namespace.html +110 -0
- data/lib/procreate/swatches/colors_helper.rb +83 -0
- data/lib/procreate/swatches/errors/invalid_format.rb +19 -0
- data/lib/procreate/swatches/errors/invalid_path.rb +16 -0
- data/lib/procreate/swatches/exporter.rb +131 -0
- data/lib/procreate/swatches/parser.rb +82 -0
- data/lib/procreate/swatches/version.rb +8 -0
- data/lib/procreate/swatches/wrapper.rb +155 -0
- data/lib/procreate/swatches.rb +60 -0
- data/procreate-swatches.gemspec +41 -0
- metadata +275 -0
@@ -0,0 +1,1168 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: Procreate::Swatches::Wrapper
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.16
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "Procreate::Swatches::Wrapper";
|
19
|
+
relpath = '../../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../../_index.html">Index (W)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../Procreate.html" title="Procreate (module)">Procreate</a></span></span> » <span class='title'><span class='object_link'><a href="../Swatches.html" title="Procreate::Swatches (module)">Swatches</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Wrapper</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Class: Procreate::Swatches::Wrapper
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">Procreate::Swatches::Wrapper</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
<dl>
|
91
|
+
<dt>Includes:</dt>
|
92
|
+
<dd><span class='object_link'><a href="ColorsHelper.html" title="Procreate::Swatches::ColorsHelper (module)">ColorsHelper</a></span></dd>
|
93
|
+
</dl>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<dl>
|
101
|
+
<dt>Defined in:</dt>
|
102
|
+
<dd>lib/procreate/swatches/wrapper.rb</dd>
|
103
|
+
</dl>
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
<h2>Overview</h2><div class="docstring">
|
108
|
+
<div class="discussion">
|
109
|
+
|
110
|
+
<p>Wrapper class for the name and colors of a <code>.swatches</code> file.</p>
|
111
|
+
|
112
|
+
|
113
|
+
</div>
|
114
|
+
</div>
|
115
|
+
<div class="tags">
|
116
|
+
|
117
|
+
|
118
|
+
</div>
|
119
|
+
|
120
|
+
<h2>
|
121
|
+
Constant Summary
|
122
|
+
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
|
123
|
+
</h2>
|
124
|
+
|
125
|
+
<dl class="constants">
|
126
|
+
|
127
|
+
<dt id="DEFAULT_SWATCHES_NAME-constant" class="">DEFAULT_SWATCHES_NAME =
|
128
|
+
<div class="docstring">
|
129
|
+
<div class="discussion">
|
130
|
+
|
131
|
+
<p>The default name, used in case a custom name is not provided</p>
|
132
|
+
|
133
|
+
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
<div class="tags">
|
137
|
+
|
138
|
+
|
139
|
+
</div>
|
140
|
+
</dt>
|
141
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>My beautiful palette</span><span class='tstring_end'>'</span></span></pre></dd>
|
142
|
+
|
143
|
+
<dt id="AVAILABLE_COLOR_FORMATS-constant" class="">AVAILABLE_COLOR_FORMATS =
|
144
|
+
<div class="docstring">
|
145
|
+
<div class="discussion">
|
146
|
+
|
147
|
+
<p>Available formats to return the colors as. These types are supported by
|
148
|
+
<a href="https://github.com/jfairbank/chroma" target="_parent" title="Chroma::Color">Chroma::Color</a></p>
|
149
|
+
|
150
|
+
|
151
|
+
</div>
|
152
|
+
</div>
|
153
|
+
<div class="tags">
|
154
|
+
|
155
|
+
|
156
|
+
</div>
|
157
|
+
</dt>
|
158
|
+
<dd><pre class="code"><span class='qsymbols_beg'>%i[</span><span class='tstring_content'>hsv</span><span class='words_sep'> </span><span class='tstring_content'>hsl</span><span class='words_sep'> </span><span class='tstring_content'>hex</span><span class='words_sep'> </span><span class='tstring_content'>hex8</span><span class='words_sep'> </span><span class='tstring_content'>rgb</span><span class='words_sep'> </span><span class='tstring_content'>name</span><span class='words_sep'>]</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
159
|
+
|
160
|
+
</dl>
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<h3 class="inherited">Constants included
|
168
|
+
from <span class='object_link'><a href="ColorsHelper.html" title="Procreate::Swatches::ColorsHelper (module)">ColorsHelper</a></span></h3>
|
169
|
+
<p class="inherited"><span class='object_link'><a href="ColorsHelper.html#SELECTED_KEYS-constant" title="Procreate::Swatches::ColorsHelper::SELECTED_KEYS (constant)">ColorsHelper::SELECTED_KEYS</a></span>, <span class='object_link'><a href="ColorsHelper.html#SWATCHES_ALPHA-constant" title="Procreate::Swatches::ColorsHelper::SWATCHES_ALPHA (constant)">ColorsHelper::SWATCHES_ALPHA</a></span>, <span class='object_link'><a href="ColorsHelper.html#SWATCHES_COLOR_SPACE-constant" title="Procreate::Swatches::ColorsHelper::SWATCHES_COLOR_SPACE (constant)">ColorsHelper::SWATCHES_COLOR_SPACE</a></span>, <span class='object_link'><a href="ColorsHelper.html#SWATCHES_MAX_SIZE-constant" title="Procreate::Swatches::ColorsHelper::SWATCHES_MAX_SIZE (constant)">ColorsHelper::SWATCHES_MAX_SIZE</a></span></p>
|
170
|
+
|
171
|
+
|
172
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
173
|
+
<ul class="summary">
|
174
|
+
|
175
|
+
<li class="public ">
|
176
|
+
<span class="summary_signature">
|
177
|
+
|
178
|
+
<a href="#colors-instance_method" title="#colors (instance method)">#<strong>colors</strong>(format: nil) ⇒ Array<Chroma::Color>, Array<String> </a>
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
</span>
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
<span class="summary_desc"><div class='inline'>
|
196
|
+
<p>Attribute reader for colors.</p>
|
197
|
+
</div></span>
|
198
|
+
|
199
|
+
</li>
|
200
|
+
|
201
|
+
|
202
|
+
<li class="public ">
|
203
|
+
<span class="summary_signature">
|
204
|
+
|
205
|
+
<a href="#name-instance_method" title="#name (instance method)">#<strong>name</strong> ⇒ String </a>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
</span>
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
<span class="summary_desc"><div class='inline'>
|
223
|
+
<p>Name of the swatches palette.</p>
|
224
|
+
</div></span>
|
225
|
+
|
226
|
+
</li>
|
227
|
+
|
228
|
+
|
229
|
+
</ul>
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
<h2>
|
236
|
+
Instance Method Summary
|
237
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
238
|
+
</h2>
|
239
|
+
|
240
|
+
<ul class="summary">
|
241
|
+
|
242
|
+
<li class="public ">
|
243
|
+
<span class="summary_signature">
|
244
|
+
|
245
|
+
<a href="#<<-instance_method" title="#<< (instance method)">#<strong><<</strong>(color) ⇒ Array<Chroma::Color> </a>
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
(also: #push)
|
250
|
+
|
251
|
+
</span>
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
<span class="summary_desc"><div class='inline'>
|
262
|
+
<p>Add a new color to the colors array.</p>
|
263
|
+
</div></span>
|
264
|
+
|
265
|
+
</li>
|
266
|
+
|
267
|
+
|
268
|
+
<li class="public ">
|
269
|
+
<span class="summary_signature">
|
270
|
+
|
271
|
+
<a href="#==-instance_method" title="#== (instance method)">#<strong>==</strong>(other) ⇒ Boolean </a>
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
</span>
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
<span class="summary_desc"><div class='inline'>
|
286
|
+
<p>Wrapper file comparison.</p>
|
287
|
+
</div></span>
|
288
|
+
|
289
|
+
</li>
|
290
|
+
|
291
|
+
|
292
|
+
<li class="public ">
|
293
|
+
<span class="summary_signature">
|
294
|
+
|
295
|
+
<a href="#available_color_formats-instance_method" title="#available_color_formats (instance method)">#<strong>available_color_formats</strong> ⇒ Array<Symbol> </a>
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
</span>
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
<span class="summary_desc"><div class='inline'>
|
310
|
+
<p>Returns the list of available color formats a color can be retrieved into.</p>
|
311
|
+
</div></span>
|
312
|
+
|
313
|
+
</li>
|
314
|
+
|
315
|
+
|
316
|
+
<li class="public ">
|
317
|
+
<span class="summary_signature">
|
318
|
+
|
319
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(name, colors) ⇒ Wrapper </a>
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
</span>
|
324
|
+
|
325
|
+
|
326
|
+
<span class="note title constructor">constructor</span>
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
<span class="summary_desc"><div class='inline'>
|
336
|
+
<p>Initialize a new instance of <span class='object_link'><a href="" title="Procreate::Swatches::Wrapper (class)">Wrapper</a></span>.</p>
|
337
|
+
</div></span>
|
338
|
+
|
339
|
+
</li>
|
340
|
+
|
341
|
+
|
342
|
+
<li class="public ">
|
343
|
+
<span class="summary_signature">
|
344
|
+
|
345
|
+
<a href="#pop-instance_method" title="#pop (instance method)">#<strong>pop</strong> ⇒ Array<Chroma::Color> </a>
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
</span>
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
<span class="summary_desc"><div class='inline'>
|
360
|
+
<p>Remove the last color from the colors array.</p>
|
361
|
+
</div></span>
|
362
|
+
|
363
|
+
</li>
|
364
|
+
|
365
|
+
|
366
|
+
<li class="public ">
|
367
|
+
<span class="summary_signature">
|
368
|
+
|
369
|
+
<a href="#to_file-instance_method" title="#to_file (instance method)">#<strong>to_file</strong>(options = {}) ⇒ String </a>
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
(also: #export)
|
374
|
+
|
375
|
+
</span>
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
<span class="summary_desc"><div class='inline'>
|
386
|
+
<p>Export the wrapper to a <code>.swatches</code> file.</p>
|
387
|
+
</div></span>
|
388
|
+
|
389
|
+
</li>
|
390
|
+
|
391
|
+
|
392
|
+
<li class="public ">
|
393
|
+
<span class="summary_signature">
|
394
|
+
|
395
|
+
<a href="#to_json-instance_method" title="#to_json (instance method)">#<strong>to_json</strong>(*_args) ⇒ String </a>
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
(also: #to_swatches, #to_procreate)
|
400
|
+
|
401
|
+
</span>
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
<span class="summary_desc"><div class='inline'>
|
412
|
+
<p>Convert the wrapper to the JSON format needed to create a
|
413
|
+
<code>.swatches</code> file.</p>
|
414
|
+
</div></span>
|
415
|
+
|
416
|
+
</li>
|
417
|
+
|
418
|
+
|
419
|
+
</ul>
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="ColorsHelper.html" title="Procreate::Swatches::ColorsHelper (module)">ColorsHelper</a></span></h3>
|
432
|
+
<p class="inherited"><span class='object_link'><a href="ColorsHelper.html#prepare_color_for_push-instance_method" title="Procreate::Swatches::ColorsHelper#prepare_color_for_push (method)">#prepare_color_for_push</a></span>, <span class='object_link'><a href="ColorsHelper.html#to_chroma_hsv-instance_method" title="Procreate::Swatches::ColorsHelper#to_chroma_hsv (method)">#to_chroma_hsv</a></span>, <span class='object_link'><a href="ColorsHelper.html#to_color_json-instance_method" title="Procreate::Swatches::ColorsHelper#to_color_json (method)">#to_color_json</a></span>, <span class='object_link'><a href="ColorsHelper.html#to_swatches_json-instance_method" title="Procreate::Swatches::ColorsHelper#to_swatches_json (method)">#to_swatches_json</a></span></p>
|
433
|
+
<div id="constructor_details" class="method_details_list">
|
434
|
+
<h2>Constructor Details</h2>
|
435
|
+
|
436
|
+
<div class="method_details first">
|
437
|
+
<h3 class="signature first" id="initialize-instance_method">
|
438
|
+
|
439
|
+
#<strong>initialize</strong>(name, colors) ⇒ <tt><span class='object_link'><a href="" title="Procreate::Swatches::Wrapper (class)">Wrapper</a></span></tt>
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
</h3><div class="docstring">
|
446
|
+
<div class="discussion">
|
447
|
+
|
448
|
+
<p>Initialize a new instance of <span class='object_link'><a href="" title="Procreate::Swatches::Wrapper (class)">Procreate::Swatches::Wrapper</a></span></p>
|
449
|
+
|
450
|
+
|
451
|
+
</div>
|
452
|
+
</div>
|
453
|
+
<div class="tags">
|
454
|
+
<p class="tag_title">Parameters:</p>
|
455
|
+
<ul class="param">
|
456
|
+
|
457
|
+
<li>
|
458
|
+
|
459
|
+
<span class='name'>name</span>
|
460
|
+
|
461
|
+
|
462
|
+
<span class='type'>(<tt>String</tt>)</span>
|
463
|
+
|
464
|
+
|
465
|
+
|
466
|
+
—
|
467
|
+
<div class='inline'>
|
468
|
+
<p>Name of the swatches palette</p>
|
469
|
+
</div>
|
470
|
+
|
471
|
+
</li>
|
472
|
+
|
473
|
+
<li>
|
474
|
+
|
475
|
+
<span class='name'>colors</span>
|
476
|
+
|
477
|
+
|
478
|
+
<span class='type'>(<tt>Array<Chroma::Color, String></tt>)</span>
|
479
|
+
|
480
|
+
|
481
|
+
|
482
|
+
—
|
483
|
+
<div class='inline'>
|
484
|
+
<p>Colors array. Each color will be converted to a
|
485
|
+
<a href="https://github.com/jfairbank/chroma" target="_parent" title="Chroma::Color">Chroma::Color</a> instance.</p>
|
486
|
+
</div>
|
487
|
+
|
488
|
+
</li>
|
489
|
+
|
490
|
+
</ul>
|
491
|
+
|
492
|
+
|
493
|
+
</div><table class="source_code">
|
494
|
+
<tr>
|
495
|
+
<td>
|
496
|
+
<pre class="lines">
|
497
|
+
|
498
|
+
|
499
|
+
27
|
500
|
+
28
|
501
|
+
29
|
502
|
+
30
|
503
|
+
31
|
504
|
+
32</pre>
|
505
|
+
</td>
|
506
|
+
<td>
|
507
|
+
<pre class="code"><span class="info file"># File 'lib/procreate/swatches/wrapper.rb', line 27</span>
|
508
|
+
|
509
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_colors'>colors</span><span class='rparen'>)</span>
|
510
|
+
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>?</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>:</span> <span class='const'><span class='object_link'><a href="#DEFAULT_SWATCHES_NAME-constant" title="Procreate::Swatches::Wrapper::DEFAULT_SWATCHES_NAME (constant)">DEFAULT_SWATCHES_NAME</a></span></span>
|
511
|
+
|
512
|
+
<span class='ivar'>@colors</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
513
|
+
<span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_colors'>colors</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_color'>color</span><span class='op'>|</span> <span class='id identifier rubyid_add_color'>add_color</span><span class='lparen'>(</span><span class='id identifier rubyid_color'>color</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
514
|
+
<span class='kw'>end</span></pre>
|
515
|
+
</td>
|
516
|
+
</tr>
|
517
|
+
</table>
|
518
|
+
</div>
|
519
|
+
|
520
|
+
</div>
|
521
|
+
|
522
|
+
<div id="instance_attr_details" class="attr_details">
|
523
|
+
<h2>Instance Attribute Details</h2>
|
524
|
+
|
525
|
+
|
526
|
+
<span id="colors=-instance_method"></span>
|
527
|
+
<div class="method_details first">
|
528
|
+
<h3 class="signature first" id="colors-instance_method">
|
529
|
+
|
530
|
+
#<strong>colors</strong>(format: nil) ⇒ <tt>Array<Chroma::Color></tt>, <tt>Array<String></tt>
|
531
|
+
|
532
|
+
|
533
|
+
|
534
|
+
|
535
|
+
|
536
|
+
</h3><div class="docstring">
|
537
|
+
<div class="discussion">
|
538
|
+
|
539
|
+
<p>Attribute reader for colors. It supports returning the colors in different
|
540
|
+
formats. If not format is provided, an array of
|
541
|
+
<a href="https://github.com/jfairbank/chroma" target="_parent" title="Chroma::Color">Chroma::Color</a>s is returned. If an
|
542
|
+
invalid format is provided, it will fallback to the default format.</p>
|
543
|
+
|
544
|
+
|
545
|
+
</div>
|
546
|
+
</div>
|
547
|
+
<div class="tags">
|
548
|
+
<p class="tag_title">Parameters:</p>
|
549
|
+
<ul class="param">
|
550
|
+
|
551
|
+
<li>
|
552
|
+
|
553
|
+
<span class='name'>format</span>
|
554
|
+
|
555
|
+
|
556
|
+
<span class='type'>(<tt>String</tt>, <tt>Symbol</tt>)</span>
|
557
|
+
|
558
|
+
|
559
|
+
|
560
|
+
—
|
561
|
+
<div class='inline'>
|
562
|
+
<p>Format to return the colors array in.</p>
|
563
|
+
</div>
|
564
|
+
|
565
|
+
</li>
|
566
|
+
|
567
|
+
</ul>
|
568
|
+
|
569
|
+
<p class="tag_title">Returns:</p>
|
570
|
+
<ul class="return">
|
571
|
+
|
572
|
+
<li>
|
573
|
+
|
574
|
+
|
575
|
+
<span class='type'>(<tt>Array<Chroma::Color></tt>)</span>
|
576
|
+
|
577
|
+
|
578
|
+
|
579
|
+
—
|
580
|
+
<div class='inline'>
|
581
|
+
<p>Return an array of <a href="https://github.com/jfairbank/chroma" target="_parent" title="Chroma::Color">Chroma::Color</a> when
|
582
|
+
no format is provided. This is the default option.</p>
|
583
|
+
</div>
|
584
|
+
|
585
|
+
</li>
|
586
|
+
|
587
|
+
<li>
|
588
|
+
|
589
|
+
|
590
|
+
<span class='type'>(<tt>Array<String></tt>)</span>
|
591
|
+
|
592
|
+
|
593
|
+
|
594
|
+
—
|
595
|
+
<div class='inline'>
|
596
|
+
<p>Return an array of <code>Strings</code>, in the specified format.</p>
|
597
|
+
</div>
|
598
|
+
|
599
|
+
</li>
|
600
|
+
|
601
|
+
</ul>
|
602
|
+
|
603
|
+
</div><table class="source_code">
|
604
|
+
<tr>
|
605
|
+
<td>
|
606
|
+
<pre class="lines">
|
607
|
+
|
608
|
+
|
609
|
+
81
|
610
|
+
82
|
611
|
+
83
|
612
|
+
84
|
613
|
+
85
|
614
|
+
86
|
615
|
+
87
|
616
|
+
88
|
617
|
+
89
|
618
|
+
90</pre>
|
619
|
+
</td>
|
620
|
+
<td>
|
621
|
+
<pre class="code"><span class="info file"># File 'lib/procreate/swatches/wrapper.rb', line 81</span>
|
622
|
+
|
623
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_colors'>colors</span><span class='lparen'>(</span><span class='label'>format:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
624
|
+
<span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='id identifier rubyid_format'>format</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span> <span class='kw'>unless</span> <span class='id identifier rubyid_format'>format</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
625
|
+
<span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='kw'>unless</span> <span class='id identifier rubyid_format'>format</span><span class='period'>.</span><span class='id identifier rubyid_in?'>in?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="#AVAILABLE_COLOR_FORMATS-constant" title="Procreate::Swatches::Wrapper::AVAILABLE_COLOR_FORMATS (constant)">AVAILABLE_COLOR_FORMATS</a></span></span><span class='rparen'>)</span>
|
626
|
+
|
627
|
+
<span class='kw'>return</span> <span class='ivar'>@colors</span> <span class='kw'>if</span> <span class='id identifier rubyid_format'>format</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
628
|
+
|
629
|
+
<span class='ivar'>@colors</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_color'>color</span><span class='op'>|</span>
|
630
|
+
<span class='id identifier rubyid_color'>color</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>to_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_format'>format</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
631
|
+
<span class='kw'>end</span>
|
632
|
+
<span class='kw'>end</span></pre>
|
633
|
+
</td>
|
634
|
+
</tr>
|
635
|
+
</table>
|
636
|
+
</div>
|
637
|
+
|
638
|
+
|
639
|
+
<span id="name=-instance_method"></span>
|
640
|
+
<div class="method_details ">
|
641
|
+
<h3 class="signature " id="name-instance_method">
|
642
|
+
|
643
|
+
#<strong>name</strong> ⇒ <tt>String</tt>
|
644
|
+
|
645
|
+
|
646
|
+
|
647
|
+
|
648
|
+
|
649
|
+
</h3><div class="docstring">
|
650
|
+
<div class="discussion">
|
651
|
+
|
652
|
+
<p>Returns Name of the swatches palette</p>
|
653
|
+
|
654
|
+
|
655
|
+
</div>
|
656
|
+
</div>
|
657
|
+
<div class="tags">
|
658
|
+
|
659
|
+
<p class="tag_title">Returns:</p>
|
660
|
+
<ul class="return">
|
661
|
+
|
662
|
+
<li>
|
663
|
+
|
664
|
+
|
665
|
+
<span class='type'>(<tt>String</tt>)</span>
|
666
|
+
|
667
|
+
|
668
|
+
|
669
|
+
—
|
670
|
+
<div class='inline'>
|
671
|
+
<p>Name of the swatches palette</p>
|
672
|
+
</div>
|
673
|
+
|
674
|
+
</li>
|
675
|
+
|
676
|
+
</ul>
|
677
|
+
|
678
|
+
</div><table class="source_code">
|
679
|
+
<tr>
|
680
|
+
<td>
|
681
|
+
<pre class="lines">
|
682
|
+
|
683
|
+
|
684
|
+
13
|
685
|
+
14
|
686
|
+
15</pre>
|
687
|
+
</td>
|
688
|
+
<td>
|
689
|
+
<pre class="code"><span class="info file"># File 'lib/procreate/swatches/wrapper.rb', line 13</span>
|
690
|
+
|
691
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
|
692
|
+
<span class='ivar'>@name</span>
|
693
|
+
<span class='kw'>end</span></pre>
|
694
|
+
</td>
|
695
|
+
</tr>
|
696
|
+
</table>
|
697
|
+
</div>
|
698
|
+
|
699
|
+
</div>
|
700
|
+
|
701
|
+
|
702
|
+
<div id="instance_method_details" class="method_details_list">
|
703
|
+
<h2>Instance Method Details</h2>
|
704
|
+
|
705
|
+
|
706
|
+
<div class="method_details first">
|
707
|
+
<h3 class="signature first" id="<<-instance_method">
|
708
|
+
|
709
|
+
#<strong><<</strong>(color) ⇒ <tt>Array<Chroma::Color></tt>
|
710
|
+
|
711
|
+
|
712
|
+
|
713
|
+
<span class="aliases">Also known as:
|
714
|
+
<span class="names"><span id='push-instance_method'>push</span></span>
|
715
|
+
</span>
|
716
|
+
|
717
|
+
|
718
|
+
|
719
|
+
</h3><div class="docstring">
|
720
|
+
<div class="discussion">
|
721
|
+
|
722
|
+
<p>Add a new color to the colors array. It will be converted to a
|
723
|
+
<a href="https://github.com/jfairbank/chroma" target="_parent" title="Chroma::Color">Chroma::Color</a> instance.</p>
|
724
|
+
|
725
|
+
|
726
|
+
</div>
|
727
|
+
</div>
|
728
|
+
<div class="tags">
|
729
|
+
<p class="tag_title">Parameters:</p>
|
730
|
+
<ul class="param">
|
731
|
+
|
732
|
+
<li>
|
733
|
+
|
734
|
+
<span class='name'>color</span>
|
735
|
+
|
736
|
+
|
737
|
+
<span class='type'>(<tt>Chroma::Color</tt>, <tt>String</tt>)</span>
|
738
|
+
|
739
|
+
|
740
|
+
|
741
|
+
—
|
742
|
+
<div class='inline'>
|
743
|
+
<p>Color in a supported format.</p>
|
744
|
+
</div>
|
745
|
+
|
746
|
+
</li>
|
747
|
+
|
748
|
+
</ul>
|
749
|
+
|
750
|
+
<p class="tag_title">Returns:</p>
|
751
|
+
<ul class="return">
|
752
|
+
|
753
|
+
<li>
|
754
|
+
|
755
|
+
|
756
|
+
<span class='type'>(<tt>Array<Chroma::Color></tt>)</span>
|
757
|
+
|
758
|
+
|
759
|
+
|
760
|
+
—
|
761
|
+
<div class='inline'>
|
762
|
+
<p>The current colors available in the wrapper.</p>
|
763
|
+
</div>
|
764
|
+
|
765
|
+
</li>
|
766
|
+
|
767
|
+
</ul>
|
768
|
+
|
769
|
+
</div><table class="source_code">
|
770
|
+
<tr>
|
771
|
+
<td>
|
772
|
+
<pre class="lines">
|
773
|
+
|
774
|
+
|
775
|
+
42
|
776
|
+
43
|
777
|
+
44</pre>
|
778
|
+
</td>
|
779
|
+
<td>
|
780
|
+
<pre class="code"><span class="info file"># File 'lib/procreate/swatches/wrapper.rb', line 42</span>
|
781
|
+
|
782
|
+
<span class='kw'>def</span> <span class='op'><<</span><span class='lparen'>(</span><span class='id identifier rubyid_color'>color</span><span class='rparen'>)</span>
|
783
|
+
<span class='id identifier rubyid_add_color'>add_color</span><span class='lparen'>(</span><span class='id identifier rubyid_color'>color</span><span class='rparen'>)</span>
|
784
|
+
<span class='kw'>end</span></pre>
|
785
|
+
</td>
|
786
|
+
</tr>
|
787
|
+
</table>
|
788
|
+
</div>
|
789
|
+
|
790
|
+
<div class="method_details ">
|
791
|
+
<h3 class="signature " id="==-instance_method">
|
792
|
+
|
793
|
+
#<strong>==</strong>(other) ⇒ <tt>Boolean</tt>
|
794
|
+
|
795
|
+
|
796
|
+
|
797
|
+
|
798
|
+
|
799
|
+
</h3><div class="docstring">
|
800
|
+
<div class="discussion">
|
801
|
+
|
802
|
+
<div class="note todo">
|
803
|
+
<strong>TODO:</strong>
|
804
|
+
<div class='inline'>
|
805
|
+
<p>Check if the colors array is the same (regardless of order)</p>
|
806
|
+
</div>
|
807
|
+
</div>
|
808
|
+
|
809
|
+
|
810
|
+
<p>Wrapper file comparison. It check for the same class, name and colors array</p>
|
811
|
+
|
812
|
+
|
813
|
+
</div>
|
814
|
+
</div>
|
815
|
+
<div class="tags">
|
816
|
+
<p class="tag_title">Parameters:</p>
|
817
|
+
<ul class="param">
|
818
|
+
|
819
|
+
<li>
|
820
|
+
|
821
|
+
<span class='name'>other</span>
|
822
|
+
|
823
|
+
|
824
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Procreate::Swatches::Wrapper (class)">Procreate::Swatches::Wrapper</a></span></tt>)</span>
|
825
|
+
|
826
|
+
|
827
|
+
|
828
|
+
—
|
829
|
+
<div class='inline'>
|
830
|
+
<p>Another wrapper instance</p>
|
831
|
+
</div>
|
832
|
+
|
833
|
+
</li>
|
834
|
+
|
835
|
+
</ul>
|
836
|
+
|
837
|
+
<p class="tag_title">Returns:</p>
|
838
|
+
<ul class="return">
|
839
|
+
|
840
|
+
<li>
|
841
|
+
|
842
|
+
|
843
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
844
|
+
|
845
|
+
|
846
|
+
|
847
|
+
—
|
848
|
+
<div class='inline'>
|
849
|
+
<p>The wrappers are equal</p>
|
850
|
+
</div>
|
851
|
+
|
852
|
+
</li>
|
853
|
+
|
854
|
+
</ul>
|
855
|
+
|
856
|
+
</div><table class="source_code">
|
857
|
+
<tr>
|
858
|
+
<td>
|
859
|
+
<pre class="lines">
|
860
|
+
|
861
|
+
|
862
|
+
134
|
863
|
+
135
|
864
|
+
136</pre>
|
865
|
+
</td>
|
866
|
+
<td>
|
867
|
+
<pre class="code"><span class="info file"># File 'lib/procreate/swatches/wrapper.rb', line 134</span>
|
868
|
+
|
869
|
+
<span class='kw'>def</span> <span class='op'>==</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
|
870
|
+
<span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>&&</span> <span class='id identifier rubyid_colors'>colors</span> <span class='op'>==</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_colors'>colors</span>
|
871
|
+
<span class='kw'>end</span></pre>
|
872
|
+
</td>
|
873
|
+
</tr>
|
874
|
+
</table>
|
875
|
+
</div>
|
876
|
+
|
877
|
+
<div class="method_details ">
|
878
|
+
<h3 class="signature " id="available_color_formats-instance_method">
|
879
|
+
|
880
|
+
#<strong>available_color_formats</strong> ⇒ <tt>Array<Symbol></tt>
|
881
|
+
|
882
|
+
|
883
|
+
|
884
|
+
|
885
|
+
|
886
|
+
</h3><div class="docstring">
|
887
|
+
<div class="discussion">
|
888
|
+
|
889
|
+
<p>Returns the list of available color formats a color can be retrieved into.</p>
|
890
|
+
|
891
|
+
|
892
|
+
</div>
|
893
|
+
</div>
|
894
|
+
<div class="tags">
|
895
|
+
|
896
|
+
<p class="tag_title">Returns:</p>
|
897
|
+
<ul class="return">
|
898
|
+
|
899
|
+
<li>
|
900
|
+
|
901
|
+
|
902
|
+
<span class='type'>(<tt>Array<Symbol></tt>)</span>
|
903
|
+
|
904
|
+
|
905
|
+
|
906
|
+
—
|
907
|
+
<div class='inline'>
|
908
|
+
<p>The list of available formats a color can be retrived into.</p>
|
909
|
+
</div>
|
910
|
+
|
911
|
+
</li>
|
912
|
+
|
913
|
+
</ul>
|
914
|
+
|
915
|
+
</div><table class="source_code">
|
916
|
+
<tr>
|
917
|
+
<td>
|
918
|
+
<pre class="lines">
|
919
|
+
|
920
|
+
|
921
|
+
66
|
922
|
+
67
|
923
|
+
68</pre>
|
924
|
+
</td>
|
925
|
+
<td>
|
926
|
+
<pre class="code"><span class="info file"># File 'lib/procreate/swatches/wrapper.rb', line 66</span>
|
927
|
+
|
928
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_available_color_formats'>available_color_formats</span>
|
929
|
+
<span class='const'><span class='object_link'><a href="#AVAILABLE_COLOR_FORMATS-constant" title="Procreate::Swatches::Wrapper::AVAILABLE_COLOR_FORMATS (constant)">AVAILABLE_COLOR_FORMATS</a></span></span>
|
930
|
+
<span class='kw'>end</span></pre>
|
931
|
+
</td>
|
932
|
+
</tr>
|
933
|
+
</table>
|
934
|
+
</div>
|
935
|
+
|
936
|
+
<div class="method_details ">
|
937
|
+
<h3 class="signature " id="pop-instance_method">
|
938
|
+
|
939
|
+
#<strong>pop</strong> ⇒ <tt>Array<Chroma::Color></tt>
|
940
|
+
|
941
|
+
|
942
|
+
|
943
|
+
|
944
|
+
|
945
|
+
</h3><div class="docstring">
|
946
|
+
<div class="discussion">
|
947
|
+
|
948
|
+
<p>Remove the last color from the colors array.</p>
|
949
|
+
|
950
|
+
|
951
|
+
</div>
|
952
|
+
</div>
|
953
|
+
<div class="tags">
|
954
|
+
|
955
|
+
<p class="tag_title">Returns:</p>
|
956
|
+
<ul class="return">
|
957
|
+
|
958
|
+
<li>
|
959
|
+
|
960
|
+
|
961
|
+
<span class='type'>(<tt>Array<Chroma::Color></tt>)</span>
|
962
|
+
|
963
|
+
|
964
|
+
|
965
|
+
—
|
966
|
+
<div class='inline'>
|
967
|
+
<p>The current colors available in the wrapper.</p>
|
968
|
+
</div>
|
969
|
+
|
970
|
+
</li>
|
971
|
+
|
972
|
+
</ul>
|
973
|
+
|
974
|
+
</div><table class="source_code">
|
975
|
+
<tr>
|
976
|
+
<td>
|
977
|
+
<pre class="lines">
|
978
|
+
|
979
|
+
|
980
|
+
53
|
981
|
+
54
|
982
|
+
55</pre>
|
983
|
+
</td>
|
984
|
+
<td>
|
985
|
+
<pre class="code"><span class="info file"># File 'lib/procreate/swatches/wrapper.rb', line 53</span>
|
986
|
+
|
987
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_pop'>pop</span>
|
988
|
+
<span class='ivar'>@colors</span><span class='period'>.</span><span class='id identifier rubyid_pop'>pop</span>
|
989
|
+
<span class='kw'>end</span></pre>
|
990
|
+
</td>
|
991
|
+
</tr>
|
992
|
+
</table>
|
993
|
+
</div>
|
994
|
+
|
995
|
+
<div class="method_details ">
|
996
|
+
<h3 class="signature " id="to_file-instance_method">
|
997
|
+
|
998
|
+
#<strong>to_file</strong>(options = {}) ⇒ <tt>String</tt>
|
999
|
+
|
1000
|
+
|
1001
|
+
|
1002
|
+
<span class="aliases">Also known as:
|
1003
|
+
<span class="names"><span id='export-instance_method'>export</span></span>
|
1004
|
+
</span>
|
1005
|
+
|
1006
|
+
|
1007
|
+
|
1008
|
+
</h3><div class="docstring">
|
1009
|
+
<div class="discussion">
|
1010
|
+
|
1011
|
+
<p>Export the wrapper to a <code>.swatches</code> file</p>
|
1012
|
+
|
1013
|
+
|
1014
|
+
</div>
|
1015
|
+
</div>
|
1016
|
+
<div class="tags">
|
1017
|
+
<p class="tag_title">Parameters:</p>
|
1018
|
+
<ul class="param">
|
1019
|
+
|
1020
|
+
<li>
|
1021
|
+
|
1022
|
+
<span class='name'>options</span>
|
1023
|
+
|
1024
|
+
|
1025
|
+
<span class='type'>(<tt><Type></tt>)</span>
|
1026
|
+
|
1027
|
+
|
1028
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
1029
|
+
|
1030
|
+
|
1031
|
+
—
|
1032
|
+
<div class='inline'>
|
1033
|
+
<p>All options suported by <span class='object_link'><a href="Exporter.html#initialize-instance_method" title="Procreate::Swatches::Exporter#initialize (method)">Exporter#initialize</a></span></p>
|
1034
|
+
</div>
|
1035
|
+
|
1036
|
+
</li>
|
1037
|
+
|
1038
|
+
</ul>
|
1039
|
+
|
1040
|
+
<p class="tag_title">Returns:</p>
|
1041
|
+
<ul class="return">
|
1042
|
+
|
1043
|
+
<li>
|
1044
|
+
|
1045
|
+
|
1046
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1047
|
+
|
1048
|
+
|
1049
|
+
|
1050
|
+
—
|
1051
|
+
<div class='inline'>
|
1052
|
+
<p>swatches_path Path of the exported <code>.swatches</code> file</p>
|
1053
|
+
</div>
|
1054
|
+
|
1055
|
+
</li>
|
1056
|
+
|
1057
|
+
</ul>
|
1058
|
+
|
1059
|
+
</div><table class="source_code">
|
1060
|
+
<tr>
|
1061
|
+
<td>
|
1062
|
+
<pre class="lines">
|
1063
|
+
|
1064
|
+
|
1065
|
+
119
|
1066
|
+
120
|
1067
|
+
121</pre>
|
1068
|
+
</td>
|
1069
|
+
<td>
|
1070
|
+
<pre class="code"><span class="info file"># File 'lib/procreate/swatches/wrapper.rb', line 119</span>
|
1071
|
+
|
1072
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_file'>to_file</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
1073
|
+
<span class='const'><span class='object_link'><a href="Exporter.html" title="Procreate::Swatches::Exporter (class)">Exporter</a></span></span><span class='period'>.</span><span class='id identifier rubyid_call'><span class='object_link'><a href="Exporter.html#call-class_method" title="Procreate::Swatches::Exporter.call (method)">call</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
1074
|
+
<span class='kw'>end</span></pre>
|
1075
|
+
</td>
|
1076
|
+
</tr>
|
1077
|
+
</table>
|
1078
|
+
</div>
|
1079
|
+
|
1080
|
+
<div class="method_details ">
|
1081
|
+
<h3 class="signature " id="to_json-instance_method">
|
1082
|
+
|
1083
|
+
#<strong>to_json</strong>(*_args) ⇒ <tt>String</tt>
|
1084
|
+
|
1085
|
+
|
1086
|
+
|
1087
|
+
<span class="aliases">Also known as:
|
1088
|
+
<span class="names"><span id='to_swatches-instance_method'>to_swatches</span>, <span id='to_procreate-instance_method'>to_procreate</span></span>
|
1089
|
+
</span>
|
1090
|
+
|
1091
|
+
|
1092
|
+
|
1093
|
+
</h3><div class="docstring">
|
1094
|
+
<div class="discussion">
|
1095
|
+
|
1096
|
+
<p>Convert the wrapper to the JSON format needed to create a
|
1097
|
+
<code>.swatches</code> file. A maximum of 30
|
1098
|
+
(<span class='object_link'><a href="ColorsHelper.html#SWATCHES_MAX_SIZE-constant" title="Procreate::Swatches::ColorsHelper::SWATCHES_MAX_SIZE (constant)">ColorsHelper::SWATCHES_MAX_SIZE</a></span>) colors is
|
1099
|
+
returned. This is a limitation of Procreate.</p>
|
1100
|
+
|
1101
|
+
|
1102
|
+
</div>
|
1103
|
+
</div>
|
1104
|
+
<div class="tags">
|
1105
|
+
|
1106
|
+
<p class="tag_title">Returns:</p>
|
1107
|
+
<ul class="return">
|
1108
|
+
|
1109
|
+
<li>
|
1110
|
+
|
1111
|
+
|
1112
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1113
|
+
|
1114
|
+
|
1115
|
+
|
1116
|
+
—
|
1117
|
+
<div class='inline'>
|
1118
|
+
<p>Wrapper content, in JSON format.</p>
|
1119
|
+
</div>
|
1120
|
+
|
1121
|
+
</li>
|
1122
|
+
|
1123
|
+
</ul>
|
1124
|
+
|
1125
|
+
</div><table class="source_code">
|
1126
|
+
<tr>
|
1127
|
+
<td>
|
1128
|
+
<pre class="lines">
|
1129
|
+
|
1130
|
+
|
1131
|
+
100
|
1132
|
+
101
|
1133
|
+
102
|
1134
|
+
103
|
1135
|
+
104
|
1136
|
+
105
|
1137
|
+
106
|
1138
|
+
107</pre>
|
1139
|
+
</td>
|
1140
|
+
<td>
|
1141
|
+
<pre class="code"><span class="info file"># File 'lib/procreate/swatches/wrapper.rb', line 100</span>
|
1142
|
+
|
1143
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_json'>to_json</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid__args'>_args</span><span class='rparen'>)</span>
|
1144
|
+
<span class='lbracket'>[</span>
|
1145
|
+
<span class='lbrace'>{</span>
|
1146
|
+
<span class='label'>name:</span> <span class='ivar'>@name</span><span class='comma'>,</span>
|
1147
|
+
<span class='label'>swatches:</span> <span class='id identifier rubyid_colors_to_json'>colors_to_json</span>
|
1148
|
+
<span class='rbrace'>}</span>
|
1149
|
+
<span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span>
|
1150
|
+
<span class='kw'>end</span></pre>
|
1151
|
+
</td>
|
1152
|
+
</tr>
|
1153
|
+
</table>
|
1154
|
+
</div>
|
1155
|
+
|
1156
|
+
</div>
|
1157
|
+
|
1158
|
+
</div>
|
1159
|
+
|
1160
|
+
<div id="footer">
|
1161
|
+
Generated on Sat Apr 27 09:32:32 2019 by
|
1162
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1163
|
+
0.9.16 (ruby-2.4.3).
|
1164
|
+
</div>
|
1165
|
+
|
1166
|
+
</div>
|
1167
|
+
</body>
|
1168
|
+
</html>
|