procreate-swatches 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +7 -0
  3. data/.gitignore +16 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +8 -0
  6. data/.ruby-version +1 -0
  7. data/.travis.yml +19 -0
  8. data/.yardopts +5 -0
  9. data/CODE_OF_CONDUCT.md +74 -0
  10. data/Gemfile +6 -0
  11. data/Gemfile.lock +102 -0
  12. data/LICENSE.txt +21 -0
  13. data/README.md +230 -0
  14. data/Rakefile +8 -0
  15. data/bin/console +14 -0
  16. data/bin/setup +8 -0
  17. data/doc/Procreate/Swatches/ColorsHelper.html +693 -0
  18. data/doc/Procreate/Swatches/Errors/InvalidFormat.html +220 -0
  19. data/doc/Procreate/Swatches/Errors/InvalidPath.html +220 -0
  20. data/doc/Procreate/Swatches/Errors.html +128 -0
  21. data/doc/Procreate/Swatches/Exporter.html +754 -0
  22. data/doc/Procreate/Swatches/Parser.html +622 -0
  23. data/doc/Procreate/Swatches/Wrapper.html +1168 -0
  24. data/doc/Procreate/Swatches.html +497 -0
  25. data/doc/Procreate.html +128 -0
  26. data/doc/_index.html +209 -0
  27. data/doc/class_list.html +51 -0
  28. data/doc/css/common.css +1 -0
  29. data/doc/css/full_list.css +58 -0
  30. data/doc/css/style.css +496 -0
  31. data/doc/file.CODE_OF_CONDUCT.html +146 -0
  32. data/doc/file.LICENSE.html +70 -0
  33. data/doc/file.README.html +296 -0
  34. data/doc/file_list.html +66 -0
  35. data/doc/frames.html +17 -0
  36. data/doc/index.html +296 -0
  37. data/doc/js/app.js +292 -0
  38. data/doc/js/full_list.js +216 -0
  39. data/doc/js/jquery.js +4 -0
  40. data/doc/method_list.html +275 -0
  41. data/doc/top-level-namespace.html +110 -0
  42. data/lib/procreate/swatches/colors_helper.rb +83 -0
  43. data/lib/procreate/swatches/errors/invalid_format.rb +19 -0
  44. data/lib/procreate/swatches/errors/invalid_path.rb +16 -0
  45. data/lib/procreate/swatches/exporter.rb +131 -0
  46. data/lib/procreate/swatches/parser.rb +82 -0
  47. data/lib/procreate/swatches/version.rb +8 -0
  48. data/lib/procreate/swatches/wrapper.rb +155 -0
  49. data/lib/procreate/swatches.rb +60 -0
  50. data/procreate-swatches.gemspec +41 -0
  51. metadata +275 -0
@@ -0,0 +1,497 @@
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
+ Module: Procreate::Swatches
8
+
9
+ &mdash; 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";
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 (S)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Procreate.html" title="Procreate (module)">Procreate</a></span></span>
41
+ &raquo;
42
+ <span class="title">Swatches</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>Module: Procreate::Swatches
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/procreate/swatches.rb<span class="defines">,<br />
82
+ lib/procreate/swatches/parser.rb,<br /> lib/procreate/swatches/version.rb,<br /> lib/procreate/swatches/wrapper.rb,<br /> lib/procreate/swatches/exporter.rb,<br /> lib/procreate/swatches/colors_helper.rb,<br /> lib/procreate/swatches/errors/invalid_path.rb,<br /> lib/procreate/swatches/errors/invalid_format.rb</span>
83
+ </dd>
84
+ </dl>
85
+
86
+ </div>
87
+
88
+ <h2>Overview</h2><div class="docstring">
89
+ <div class="discussion">
90
+
91
+ <p>Interact with <code>.swatches</code> files (<a href="https://procreate.art" target="_parent" title="Procreate">Procreate</a>) and manipulate them.</p>
92
+
93
+
94
+ </div>
95
+ </div>
96
+ <div class="tags">
97
+
98
+
99
+ </div><h2>Defined Under Namespace</h2>
100
+ <p class="children">
101
+
102
+
103
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Swatches/ColorsHelper.html" title="Procreate::Swatches::ColorsHelper (module)">ColorsHelper</a></span>, <span class='object_link'><a href="Swatches/Errors.html" title="Procreate::Swatches::Errors (module)">Errors</a></span>
104
+
105
+
106
+
107
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Swatches/Exporter.html" title="Procreate::Swatches::Exporter (class)">Exporter</a></span>, <span class='object_link'><a href="Swatches/Parser.html" title="Procreate::Swatches::Parser (class)">Parser</a></span>, <span class='object_link'><a href="Swatches/Wrapper.html" title="Procreate::Swatches::Wrapper (class)">Wrapper</a></span>
108
+
109
+
110
+ </p>
111
+
112
+
113
+ <h2>
114
+ Constant Summary
115
+ <small><a href="#" class="constants_summary_toggle">collapse</a></small>
116
+ </h2>
117
+
118
+ <dl class="constants">
119
+
120
+ <dt id="SWATCHES_FILE_NAME-constant" class="">SWATCHES_FILE_NAME =
121
+ <div class="docstring">
122
+ <div class="discussion">
123
+
124
+ <p>Internal name of the <code>.swatches</code> file. Used for both parsing and
125
+ exporting <code>.swatches</code> files.</p>
126
+
127
+
128
+ </div>
129
+ </div>
130
+ <div class="tags">
131
+
132
+
133
+ </div>
134
+ </dt>
135
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Swatches.json</span><span class='tstring_end'>&#39;</span></span></pre></dd>
136
+
137
+ <dt id="VERSION-constant" class="">VERSION =
138
+ <div class="docstring">
139
+ <div class="discussion">
140
+
141
+ <p>Current gem version</p>
142
+
143
+
144
+ </div>
145
+ </div>
146
+ <div class="tags">
147
+
148
+
149
+ </div>
150
+ </dt>
151
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>0.1.0</span><span class='tstring_end'>&#39;</span></span></pre></dd>
152
+
153
+ </dl>
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+ <h2>
164
+ Class Method Summary
165
+ <small><a href="#" class="summary_toggle">collapse</a></small>
166
+ </h2>
167
+
168
+ <ul class="summary">
169
+
170
+ <li class="public ">
171
+ <span class="summary_signature">
172
+
173
+ <a href="#export-class_method" title="export (class method)">.<strong>export</strong>(name, colors, options = {}) &#x21d2; String </a>
174
+
175
+
176
+
177
+ (also: to_file)
178
+
179
+ </span>
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+ <span class="summary_desc"><div class='inline'>
190
+ <p>Export an array of colors to a <code>.swatches</code> file, with the
191
+ possibility to provide a custom palette name.</p>
192
+ </div></span>
193
+
194
+ </li>
195
+
196
+
197
+ <li class="public ">
198
+ <span class="summary_signature">
199
+
200
+ <a href="#parse-class_method" title="parse (class method)">.<strong>parse</strong>(file_path) &#x21d2; Procreate::Swatches::Wrapper </a>
201
+
202
+
203
+
204
+ (also: from_file)
205
+
206
+ </span>
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+ <span class="summary_desc"><div class='inline'>
217
+ <p>Parse a <code>.swatches</code> file from the provided file path.</p>
218
+ </div></span>
219
+
220
+ </li>
221
+
222
+
223
+ </ul>
224
+
225
+
226
+
227
+
228
+ <div id="class_method_details" class="method_details_list">
229
+ <h2>Class Method Details</h2>
230
+
231
+
232
+ <div class="method_details first">
233
+ <h3 class="signature first" id="export-class_method">
234
+
235
+ .<strong>export</strong>(name, colors, options = {}) &#x21d2; <tt>String</tt>
236
+
237
+
238
+
239
+ <span class="aliases">Also known as:
240
+ <span class="names"><span id='to_file-class_method'>to_file</span></span>
241
+ </span>
242
+
243
+
244
+
245
+ </h3><div class="docstring">
246
+ <div class="discussion">
247
+
248
+ <p>Export an array of colors to a <code>.swatches</code> file, with the
249
+ possibility to provide a custom palette name.</p>
250
+
251
+
252
+ </div>
253
+ </div>
254
+ <div class="tags">
255
+ <p class="tag_title">Parameters:</p>
256
+ <ul class="param">
257
+
258
+ <li>
259
+
260
+ <span class='name'>name</span>
261
+
262
+
263
+ <span class='type'>(<tt>String</tt>)</span>
264
+
265
+
266
+
267
+ &mdash;
268
+ <div class='inline'>
269
+ <p>Preferred name for the exported <code>.swatches</code> file palette.
270
+ Visible instance the Procreate app.</p>
271
+ </div>
272
+
273
+ </li>
274
+
275
+ <li>
276
+
277
+ <span class='name'>colors</span>
278
+
279
+
280
+ <span class='type'>(<tt>Array&lt;String, Chroma::Color&gt;</tt>)</span>
281
+
282
+
283
+
284
+ &mdash;
285
+ <div class='inline'>
286
+ <p>An array of valid color strings or <a href="https://github.com/jfairbank/chroma" target="_parent" title="Chroma::Color">Chroma::Color</a> instances</p>
287
+ </div>
288
+
289
+ </li>
290
+
291
+ <li>
292
+
293
+ <span class='name'>options</span>
294
+
295
+
296
+ <span class='type'>(<tt>Hash</tt>)</span>
297
+
298
+
299
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
300
+
301
+
302
+ &mdash;
303
+ <div class='inline'>
304
+ <p>Options for exporting the wrapper</p>
305
+ </div>
306
+
307
+ </li>
308
+
309
+ </ul>
310
+
311
+
312
+
313
+
314
+
315
+
316
+
317
+
318
+ <p class="tag_title">Options Hash (<tt>options</tt>):</p>
319
+ <ul class="option">
320
+
321
+ <li>
322
+ <span class="name">:export_directory</span>
323
+ <span class="type">(<tt>String</tt>)</span>
324
+ <span class="default">
325
+
326
+ &mdash; default:
327
+ <tt>&#39;Dir.pwd&#39;</tt>
328
+
329
+ </span>
330
+
331
+ &mdash; <div class='inline'>
332
+ <p>The export directory for the <code>.swatches</code> file</p>
333
+ </div>
334
+
335
+ </li>
336
+
337
+ <li>
338
+ <span class="name">:file_name</span>
339
+ <span class="type">(<tt>String</tt>)</span>
340
+ <span class="default">
341
+
342
+ &mdash; default:
343
+ <tt>&#39;Wrapper#name&#39;</tt>
344
+
345
+ </span>
346
+
347
+ &mdash; <div class='inline'>
348
+ <p>Custom file name for the exported <code>.swatches</code> file. If none is
349
+ provided, the <code>name</code> of the <code>wrapper</code> instance is
350
+ used</p>
351
+ </div>
352
+
353
+ </li>
354
+
355
+ </ul>
356
+
357
+
358
+ <p class="tag_title">Returns:</p>
359
+ <ul class="return">
360
+
361
+ <li>
362
+
363
+
364
+ <span class='type'>(<tt>String</tt>)</span>
365
+
366
+
367
+
368
+ &mdash;
369
+ <div class='inline'>
370
+ <p>swatches_path Path of the exported <code>.swatches</code> file</p>
371
+ </div>
372
+
373
+ </li>
374
+
375
+ </ul>
376
+
377
+ </div><table class="source_code">
378
+ <tr>
379
+ <td>
380
+ <pre class="lines">
381
+
382
+
383
+ 50
384
+ 51
385
+ 52
386
+ 53
387
+ 54</pre>
388
+ </td>
389
+ <td>
390
+ <pre class="code"><span class="info file"># File 'lib/procreate/swatches.rb', line 50</span>
391
+
392
+ <span class='kw'>def</span> <span class='id identifier rubyid_export'>export</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='comma'>,</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>
393
+ <span class='id identifier rubyid_wrapper'>wrapper</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Swatches/Wrapper.html" title="Procreate::Swatches::Wrapper (class)">Wrapper</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Swatches/Wrapper.html#initialize-instance_method" title="Procreate::Swatches::Wrapper#initialize (method)">new</a></span></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>
394
+
395
+ <span class='const'><span class='object_link'><a href="Swatches/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="Swatches/Exporter.html#call-class_method" title="Procreate::Swatches::Exporter.call (method)">call</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_wrapper'>wrapper</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
396
+ <span class='kw'>end</span></pre>
397
+ </td>
398
+ </tr>
399
+ </table>
400
+ </div>
401
+
402
+ <div class="method_details ">
403
+ <h3 class="signature " id="parse-class_method">
404
+
405
+ .<strong>parse</strong>(file_path) &#x21d2; <tt><span class='object_link'><a href="Swatches/Wrapper.html" title="Procreate::Swatches::Wrapper (class)">Procreate::Swatches::Wrapper</a></span></tt>
406
+
407
+
408
+
409
+ <span class="aliases">Also known as:
410
+ <span class="names"><span id='from_file-class_method'>from_file</span></span>
411
+ </span>
412
+
413
+
414
+
415
+ </h3><div class="docstring">
416
+ <div class="discussion">
417
+
418
+ <p>Parse a <code>.swatches</code> file from the provided file path</p>
419
+
420
+
421
+ </div>
422
+ </div>
423
+ <div class="tags">
424
+ <p class="tag_title">Parameters:</p>
425
+ <ul class="param">
426
+
427
+ <li>
428
+
429
+ <span class='name'>file_path</span>
430
+
431
+
432
+ <span class='type'>(<tt>String</tt>)</span>
433
+
434
+
435
+
436
+ &mdash;
437
+ <div class='inline'>
438
+ <p>A file path to the <code>.swatches</code> file</p>
439
+ </div>
440
+
441
+ </li>
442
+
443
+ </ul>
444
+
445
+ <p class="tag_title">Returns:</p>
446
+ <ul class="return">
447
+
448
+ <li>
449
+
450
+
451
+ <span class='type'>(<tt><span class='object_link'><a href="Swatches/Wrapper.html" title="Procreate::Swatches::Wrapper (class)">Procreate::Swatches::Wrapper</a></span></tt>)</span>
452
+
453
+
454
+
455
+ &mdash;
456
+ <div class='inline'>
457
+ <p>wrapper A wrapper instance to be further manipulated</p>
458
+ </div>
459
+
460
+ </li>
461
+
462
+ </ul>
463
+
464
+ </div><table class="source_code">
465
+ <tr>
466
+ <td>
467
+ <pre class="lines">
468
+
469
+
470
+ 35
471
+ 36
472
+ 37</pre>
473
+ </td>
474
+ <td>
475
+ <pre class="code"><span class="info file"># File 'lib/procreate/swatches.rb', line 35</span>
476
+
477
+ <span class='kw'>def</span> <span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='rparen'>)</span>
478
+ <span class='const'><span class='object_link'><a href="Swatches/Parser.html" title="Procreate::Swatches::Parser (class)">Parser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_call'><span class='object_link'><a href="Swatches/Parser.html#call-class_method" title="Procreate::Swatches::Parser.call (method)">call</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='rparen'>)</span>
479
+ <span class='kw'>end</span></pre>
480
+ </td>
481
+ </tr>
482
+ </table>
483
+ </div>
484
+
485
+ </div>
486
+
487
+ </div>
488
+
489
+ <div id="footer">
490
+ Generated on Sat Apr 27 09:32:32 2019 by
491
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
492
+ 0.9.16 (ruby-2.4.3).
493
+ </div>
494
+
495
+ </div>
496
+ </body>
497
+ </html>
@@ -0,0 +1,128 @@
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
+ Module: Procreate
8
+
9
+ &mdash; 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";
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 (P)</a> &raquo;
40
+
41
+
42
+ <span class="title">Procreate</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>Module: Procreate
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/procreate/swatches.rb<span class="defines">,<br />
82
+ lib/procreate/swatches/parser.rb,<br /> lib/procreate/swatches/version.rb,<br /> lib/procreate/swatches/wrapper.rb,<br /> lib/procreate/swatches/exporter.rb,<br /> lib/procreate/swatches/colors_helper.rb,<br /> lib/procreate/swatches/errors/invalid_path.rb,<br /> lib/procreate/swatches/errors/invalid_format.rb</span>
83
+ </dd>
84
+ </dl>
85
+
86
+ </div>
87
+
88
+ <h2>Overview</h2><div class="docstring">
89
+ <div class="discussion">
90
+
91
+ <p>All things <a href="https://procreate.art" target="_parent" title="Procreate">Procreate</a> tools.</p>
92
+
93
+
94
+ </div>
95
+ </div>
96
+ <div class="tags">
97
+
98
+
99
+ </div><h2>Defined Under Namespace</h2>
100
+ <p class="children">
101
+
102
+
103
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Procreate/Swatches.html" title="Procreate::Swatches (module)">Swatches</a></span>
104
+
105
+
106
+
107
+
108
+ </p>
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+ </div>
119
+
120
+ <div id="footer">
121
+ Generated on Sat Apr 27 09:32:32 2019 by
122
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
123
+ 0.9.16 (ruby-2.4.3).
124
+ </div>
125
+
126
+ </div>
127
+ </body>
128
+ </html>