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,693 @@
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::ColorsHelper
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::ColorsHelper";
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 (C)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../Procreate.html" title="Procreate (module)">Procreate</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Swatches.html" title="Procreate::Swatches (module)">Swatches</a></span></span>
41
+ &raquo;
42
+ <span class="title">ColorsHelper</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::ColorsHelper
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+ <dl>
78
+ <dt>Included in:</dt>
79
+ <dd><span class='object_link'><a href="Parser.html" title="Procreate::Swatches::Parser (class)">Parser</a></span>, <span class='object_link'><a href="Wrapper.html" title="Procreate::Swatches::Wrapper (class)">Wrapper</a></span></dd>
80
+ </dl>
81
+
82
+
83
+
84
+ <dl>
85
+ <dt>Defined in:</dt>
86
+ <dd>lib/procreate/swatches/colors_helper.rb</dd>
87
+ </dl>
88
+
89
+ </div>
90
+
91
+ <h2>Overview</h2><div class="docstring">
92
+ <div class="discussion">
93
+
94
+ <p>Helper module to interact with colors</p>
95
+
96
+
97
+ </div>
98
+ </div>
99
+ <div class="tags">
100
+
101
+
102
+ </div>
103
+
104
+ <h2>
105
+ Constant Summary
106
+ <small><a href="#" class="constants_summary_toggle">collapse</a></small>
107
+ </h2>
108
+
109
+ <dl class="constants">
110
+
111
+ <dt id="SWATCHES_MAX_SIZE-constant" class="">SWATCHES_MAX_SIZE =
112
+ <div class="docstring">
113
+ <div class="discussion">
114
+
115
+ <p><code>.swatches</code> files can hold a maximum of 30 colors.</p>
116
+
117
+
118
+ </div>
119
+ </div>
120
+ <div class="tags">
121
+
122
+
123
+ </div>
124
+ </dt>
125
+ <dd><pre class="code"><span class='int'>30</span></pre></dd>
126
+
127
+ <dt id="SWATCHES_ALPHA-constant" class="">SWATCHES_ALPHA =
128
+ <div class="docstring">
129
+ <div class="discussion">
130
+
131
+ <p>Procreate <code>.swatches</code> don&#39;t consider the opacity, therefore
132
+ a default value of 1 is used.</p>
133
+
134
+
135
+ </div>
136
+ </div>
137
+ <div class="tags">
138
+
139
+
140
+ </div>
141
+ </dt>
142
+ <dd><pre class="code"><span class='int'>1</span></pre></dd>
143
+
144
+ <dt id="SWATCHES_COLOR_SPACE-constant" class="">SWATCHES_COLOR_SPACE =
145
+
146
+ </dt>
147
+ <dd><pre class="code"><span class='int'>0</span></pre></dd>
148
+
149
+ <dt id="SELECTED_KEYS-constant" class="">SELECTED_KEYS =
150
+
151
+ </dt>
152
+ <dd><pre class="code"><span class='qwords_beg'>%w[</span><span class='tstring_content'>hue</span><span class='words_sep'> </span><span class='tstring_content'>saturation</span><span class='words_sep'> </span><span class='tstring_content'>brightness</span><span class='words_sep'>]</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
153
+
154
+ </dl>
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+ <h2>
165
+ Instance Method Summary
166
+ <small><a href="#" class="summary_toggle">collapse</a></small>
167
+ </h2>
168
+
169
+ <ul class="summary">
170
+
171
+ <li class="public ">
172
+ <span class="summary_signature">
173
+
174
+ <a href="#prepare_color_for_push-instance_method" title="#prepare_color_for_push (instance method)">#<strong>prepare_color_for_push</strong>(color) &#x21d2; Chroma::Color<sup>?</sup> </a>
175
+
176
+
177
+
178
+ </span>
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+ <span class="summary_desc"><div class='inline'>
189
+ <p>Checks a “color” before adding it to a <span class='object_link'><a href="Wrapper.html" title="Procreate::Swatches::Wrapper (class)">Wrapper</a></span>
190
+ instance&#39;s colors array.</p>
191
+ </div></span>
192
+
193
+ </li>
194
+
195
+
196
+ <li class="public ">
197
+ <span class="summary_signature">
198
+
199
+ <a href="#to_chroma_hsv-instance_method" title="#to_chroma_hsv (instance method)">#<strong>to_chroma_hsv</strong>(color) &#x21d2; String </a>
200
+
201
+
202
+
203
+ </span>
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+ <span class="summary_desc"><div class='inline'>
214
+ <p>Generates a string formatted to initialize a
215
+ <a href="https://github.com/jfairbank/chroma" target="_parent" title="Chroma::Color">Chroma::Color</a> from HSV values.</p>
216
+ </div></span>
217
+
218
+ </li>
219
+
220
+
221
+ <li class="public ">
222
+ <span class="summary_signature">
223
+
224
+ <a href="#to_color_json-instance_method" title="#to_color_json (instance method)">#<strong>to_color_json</strong>(hue, saturation, brightness) &#x21d2; Hash{hue =&gt; Float, saturation =&gt; Float, brightness =&gt; Float, alpha =&gt; Integer, colorSpace =&gt; Integer} </a>
225
+
226
+
227
+
228
+ </span>
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+ <span class="summary_desc"><div class='inline'>
239
+ <p>Transforms the HSV (HSB) parameters into a hash, to be exported to the
240
+ <code>.swatches</code> file.</p>
241
+ </div></span>
242
+
243
+ </li>
244
+
245
+
246
+ <li class="public ">
247
+ <span class="summary_signature">
248
+
249
+ <a href="#to_swatches_json-instance_method" title="#to_swatches_json (instance method)">#<strong>to_swatches_json</strong>(color) &#x21d2; Hash{hue =&gt; Float, saturation =&gt; Float, brightness =&gt; Float, alpha =&gt; Integer, colorSpace =&gt; Integer} </a>
250
+
251
+
252
+
253
+ </span>
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+ <span class="summary_desc"><div class='inline'>
264
+ <p>Transforms the <a href="https://github.com/jfairbank/chroma" target="_parent" title="Chroma::Color">Chroma::Color</a> color be
265
+ exported to the <code>.swatches</code> file.</p>
266
+ </div></span>
267
+
268
+ </li>
269
+
270
+
271
+ </ul>
272
+
273
+
274
+
275
+
276
+ <div id="instance_method_details" class="method_details_list">
277
+ <h2>Instance Method Details</h2>
278
+
279
+
280
+ <div class="method_details first">
281
+ <h3 class="signature first" id="prepare_color_for_push-instance_method">
282
+
283
+ #<strong>prepare_color_for_push</strong>(color) &#x21d2; <tt>Chroma::Color</tt><sup>?</sup>
284
+
285
+
286
+
287
+
288
+
289
+ </h3><div class="docstring">
290
+ <div class="discussion">
291
+
292
+ <p>Checks a “color” before adding it to a <span class='object_link'><a href="Wrapper.html" title="Procreate::Swatches::Wrapper (class)">Wrapper</a></span>
293
+ instance&#39;s colors array.</p>
294
+
295
+
296
+ </div>
297
+ </div>
298
+ <div class="tags">
299
+ <p class="tag_title">Parameters:</p>
300
+ <ul class="param">
301
+
302
+ <li>
303
+
304
+ <span class='name'>color</span>
305
+
306
+
307
+ <span class='type'>(<tt>Chroma::Color</tt>, <tt>String</tt>)</span>
308
+
309
+
310
+
311
+ &mdash;
312
+ <div class='inline'>
313
+ <p>A string or a <a href="https://github.com/jfairbank/chroma" target="_parent" title="Chroma::Color">Chroma::Color</a></p>
314
+ </div>
315
+
316
+ </li>
317
+
318
+ </ul>
319
+
320
+ <p class="tag_title">Returns:</p>
321
+ <ul class="return">
322
+
323
+ <li>
324
+
325
+
326
+ <span class='type'>(<tt>Chroma::Color</tt>)</span>
327
+
328
+
329
+
330
+ &mdash;
331
+ <div class='inline'>
332
+ <p>Return a <a href="https://github.com/jfairbank/chroma" target="_parent" title="Chroma::Color">Chroma::Color</a> if the color
333
+ is already an instance of <a href="https://github.com/jfairbank/chroma" target="_parent" title="Chroma::Color">Chroma::Color</a>, or the string can be converted to one.</p>
334
+ </div>
335
+
336
+ </li>
337
+
338
+ <li>
339
+
340
+
341
+ <span class='type'>(<tt>nil</tt>)</span>
342
+
343
+
344
+
345
+ &mdash;
346
+ <div class='inline'>
347
+ <p>Returns nil when <a href="https://github.com/jfairbank/chroma" target="_parent" title="Chroma::Color">Chroma::Color</a>
348
+ can&#39;t build a color object from the provided string</p>
349
+ </div>
350
+
351
+ </li>
352
+
353
+ </ul>
354
+
355
+ </div><table class="source_code">
356
+ <tr>
357
+ <td>
358
+ <pre class="lines">
359
+
360
+
361
+ 72
362
+ 73
363
+ 74
364
+ 75
365
+ 76
366
+ 77
367
+ 78
368
+ 79
369
+ 80</pre>
370
+ </td>
371
+ <td>
372
+ <pre class="code"><span class="info file"># File 'lib/procreate/swatches/colors_helper.rb', line 72</span>
373
+
374
+ <span class='kw'>def</span> <span class='id identifier rubyid_prepare_color_for_push'>prepare_color_for_push</span><span class='lparen'>(</span><span class='id identifier rubyid_color'>color</span><span class='rparen'>)</span>
375
+ <span class='kw'>return</span> <span class='id identifier rubyid_color'>color</span> <span class='kw'>if</span> <span class='id identifier rubyid_color'>color</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Chroma</span><span class='op'>::</span><span class='const'>Color</span><span class='rparen'>)</span>
376
+
377
+ <span class='kw'>begin</span>
378
+ <span class='const'>Chroma</span><span class='op'>::</span><span class='const'>Color</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_color'>color</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span><span class='rparen'>)</span>
379
+ <span class='kw'>rescue</span> <span class='const'>Chroma</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>UnrecognizedColor</span>
380
+ <span class='kw'>nil</span>
381
+ <span class='kw'>end</span>
382
+ <span class='kw'>end</span></pre>
383
+ </td>
384
+ </tr>
385
+ </table>
386
+ </div>
387
+
388
+ <div class="method_details ">
389
+ <h3 class="signature " id="to_chroma_hsv-instance_method">
390
+
391
+ #<strong>to_chroma_hsv</strong>(color) &#x21d2; <tt>String</tt>
392
+
393
+
394
+
395
+
396
+
397
+ </h3><div class="docstring">
398
+ <div class="discussion">
399
+
400
+ <p>Generates a string formatted to initialize a
401
+ <a href="https://github.com/jfairbank/chroma" target="_parent" title="Chroma::Color">Chroma::Color</a> from HSV values</p>
402
+
403
+
404
+ </div>
405
+ </div>
406
+ <div class="tags">
407
+ <p class="tag_title">Parameters:</p>
408
+ <ul class="param">
409
+
410
+ <li>
411
+
412
+ <span class='name'>color</span>
413
+
414
+
415
+ <span class='type'>(<tt>Hash{hue =&gt; Float, saturation =&gt; Float, brightness =&gt; Float}</tt>)</span>
416
+
417
+
418
+
419
+ &mdash;
420
+ <div class='inline'>
421
+ <p>Color as hash (from parsed <code>.swatches</code> file)</p>
422
+ </div>
423
+
424
+ </li>
425
+
426
+ </ul>
427
+
428
+ <p class="tag_title">Returns:</p>
429
+ <ul class="return">
430
+
431
+ <li>
432
+
433
+
434
+ <span class='type'>(<tt>String</tt>)</span>
435
+
436
+
437
+
438
+ &mdash;
439
+ <div class='inline'>
440
+ <p>string String formatted to initialize a
441
+ <a href="https://github.com/jfairbank/chroma" target="_parent" title="Chroma::Color">Chroma::Color</a> from HSV values</p>
442
+ </div>
443
+
444
+ </li>
445
+
446
+ </ul>
447
+
448
+ </div><table class="source_code">
449
+ <tr>
450
+ <td>
451
+ <pre class="lines">
452
+
453
+
454
+ 57
455
+ 58
456
+ 59
457
+ 60
458
+ 61
459
+ 62</pre>
460
+ </td>
461
+ <td>
462
+ <pre class="code"><span class="info file"># File 'lib/procreate/swatches/colors_helper.rb', line 57</span>
463
+
464
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_chroma_hsv'>to_chroma_hsv</span><span class='lparen'>(</span><span class='id identifier rubyid_color'>color</span><span class='rparen'>)</span>
465
+ <span class='id identifier rubyid_hue'>hue</span><span class='comma'>,</span> <span class='id identifier rubyid_saturation'>saturation</span><span class='comma'>,</span> <span class='id identifier rubyid_brightness'>brightness</span> <span class='op'>=</span> <span class='op'>*</span><span class='id identifier rubyid_color'>color</span><span class='period'>.</span><span class='id identifier rubyid_values_at'>values_at</span><span class='lparen'>(</span><span class='op'>*</span><span class='const'><span class='object_link'><a href="#SELECTED_KEYS-constant" title="Procreate::Swatches::ColorsHelper::SELECTED_KEYS (constant)">SELECTED_KEYS</a></span></span><span class='rparen'>)</span>
466
+ <span class='id identifier rubyid_hue'>hue</span><span class='comma'>,</span> <span class='id identifier rubyid_saturation'>saturation</span><span class='comma'>,</span> <span class='id identifier rubyid_brightness'>brightness</span> <span class='op'>=</span> <span class='op'>*</span><span class='lbracket'>[</span><span class='id identifier rubyid_hue'>hue</span> <span class='op'>*</span> <span class='int'>360</span><span class='comma'>,</span> <span class='id identifier rubyid_saturation'>saturation</span> <span class='op'>*</span> <span class='int'>100</span><span class='comma'>,</span> <span class='id identifier rubyid_brightness'>brightness</span> <span class='op'>*</span> <span class='int'>100</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:round</span><span class='rparen'>)</span>
467
+
468
+ <span class='op'>+</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>hsv(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_hue'>hue</span><span class='embexpr_end'>}</span><span class='tstring_content'>, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_saturation'>saturation</span><span class='embexpr_end'>}</span><span class='tstring_content'>%, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_brightness'>brightness</span><span class='embexpr_end'>}</span><span class='tstring_content'>%)</span><span class='tstring_end'>&quot;</span></span>
469
+ <span class='kw'>end</span></pre>
470
+ </td>
471
+ </tr>
472
+ </table>
473
+ </div>
474
+
475
+ <div class="method_details ">
476
+ <h3 class="signature " id="to_color_json-instance_method">
477
+
478
+ #<strong>to_color_json</strong>(hue, saturation, brightness) &#x21d2; <tt>Hash{hue =&gt; Float, saturation =&gt; Float, brightness =&gt; Float, alpha =&gt; Integer, colorSpace =&gt; Integer}</tt>
479
+
480
+
481
+
482
+
483
+
484
+ </h3><div class="docstring">
485
+ <div class="discussion">
486
+
487
+ <p>Transforms the HSV (HSB) parameters into a hash, to be exported to the
488
+ <code>.swatches</code> file.</p>
489
+
490
+
491
+ </div>
492
+ </div>
493
+ <div class="tags">
494
+ <p class="tag_title">Parameters:</p>
495
+ <ul class="param">
496
+
497
+ <li>
498
+
499
+ <span class='name'>hue</span>
500
+
501
+
502
+ <span class='type'>(<tt>Float</tt>, <tt>Integer</tt>)</span>
503
+
504
+
505
+
506
+ &mdash;
507
+ <div class='inline'>
508
+ <p>Hue</p>
509
+ </div>
510
+
511
+ </li>
512
+
513
+ <li>
514
+
515
+ <span class='name'>saturation</span>
516
+
517
+
518
+ <span class='type'>(<tt>Float</tt>, <tt>Integer</tt>)</span>
519
+
520
+
521
+
522
+ &mdash;
523
+ <div class='inline'>
524
+ <p>Saturation</p>
525
+ </div>
526
+
527
+ </li>
528
+
529
+ <li>
530
+
531
+ <span class='name'>brightness</span>
532
+
533
+
534
+ <span class='type'>(<tt>Float</tt>, <tt>Integer</tt>)</span>
535
+
536
+
537
+
538
+ &mdash;
539
+ <div class='inline'>
540
+ <p>Brightness/Value</p>
541
+ </div>
542
+
543
+ </li>
544
+
545
+ </ul>
546
+
547
+ <p class="tag_title">Returns:</p>
548
+ <ul class="return">
549
+
550
+ <li>
551
+
552
+
553
+ <span class='type'>(<tt>Hash{hue =&gt; Float, saturation =&gt; Float, brightness =&gt; Float, alpha =&gt; Integer, colorSpace =&gt; Integer}</tt>)</span>
554
+
555
+
556
+
557
+ </li>
558
+
559
+ </ul>
560
+
561
+ </div><table class="source_code">
562
+ <tr>
563
+ <td>
564
+ <pre class="lines">
565
+
566
+
567
+ 40
568
+ 41
569
+ 42
570
+ 43
571
+ 44
572
+ 45
573
+ 46
574
+ 47
575
+ 48</pre>
576
+ </td>
577
+ <td>
578
+ <pre class="code"><span class="info file"># File 'lib/procreate/swatches/colors_helper.rb', line 40</span>
579
+
580
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_color_json'>to_color_json</span><span class='lparen'>(</span><span class='id identifier rubyid_hue'>hue</span><span class='comma'>,</span> <span class='id identifier rubyid_saturation'>saturation</span><span class='comma'>,</span> <span class='id identifier rubyid_brightness'>brightness</span><span class='rparen'>)</span>
581
+ <span class='lbrace'>{</span>
582
+ <span class='label'>hue:</span> <span class='id identifier rubyid_hue'>hue</span><span class='comma'>,</span>
583
+ <span class='label'>saturation:</span> <span class='id identifier rubyid_saturation'>saturation</span><span class='comma'>,</span>
584
+ <span class='label'>brightness:</span> <span class='id identifier rubyid_brightness'>brightness</span><span class='comma'>,</span>
585
+ <span class='label'>alpha:</span> <span class='const'><span class='object_link'><a href="#SWATCHES_ALPHA-constant" title="Procreate::Swatches::ColorsHelper::SWATCHES_ALPHA (constant)">SWATCHES_ALPHA</a></span></span><span class='comma'>,</span>
586
+ <span class='label'>colorSpace:</span> <span class='const'><span class='object_link'><a href="#SWATCHES_COLOR_SPACE-constant" title="Procreate::Swatches::ColorsHelper::SWATCHES_COLOR_SPACE (constant)">SWATCHES_COLOR_SPACE</a></span></span>
587
+ <span class='rbrace'>}</span>
588
+ <span class='kw'>end</span></pre>
589
+ </td>
590
+ </tr>
591
+ </table>
592
+ </div>
593
+
594
+ <div class="method_details ">
595
+ <h3 class="signature " id="to_swatches_json-instance_method">
596
+
597
+ #<strong>to_swatches_json</strong>(color) &#x21d2; <tt>Hash{hue =&gt; Float, saturation =&gt; Float, brightness =&gt; Float, alpha =&gt; Integer, colorSpace =&gt; Integer}</tt>
598
+
599
+
600
+
601
+
602
+
603
+ </h3><div class="docstring">
604
+ <div class="discussion">
605
+
606
+ <p>Transforms the <a href="https://github.com/jfairbank/chroma" target="_parent" title="Chroma::Color">Chroma::Color</a> color be
607
+ exported to the <code>.swatches</code> file.</p>
608
+
609
+
610
+ </div>
611
+ </div>
612
+ <div class="tags">
613
+ <p class="tag_title">Parameters:</p>
614
+ <ul class="param">
615
+
616
+ <li>
617
+
618
+ <span class='name'>color</span>
619
+
620
+
621
+ <span class='type'>(<tt>Chroma::Color</tt>)</span>
622
+
623
+
624
+
625
+ &mdash;
626
+ <div class='inline'>
627
+ <p>Color</p>
628
+ </div>
629
+
630
+ </li>
631
+
632
+ </ul>
633
+
634
+ <p class="tag_title">Returns:</p>
635
+ <ul class="return">
636
+
637
+ <li>
638
+
639
+
640
+ <span class='type'>(<tt>Hash{hue =&gt; Float, saturation =&gt; Float, brightness =&gt; Float, alpha =&gt; Integer, colorSpace =&gt; Integer}</tt>)</span>
641
+
642
+
643
+
644
+ </li>
645
+
646
+ </ul>
647
+
648
+ </div><table class="source_code">
649
+ <tr>
650
+ <td>
651
+ <pre class="lines">
652
+
653
+
654
+ 20
655
+ 21
656
+ 22
657
+ 23
658
+ 24
659
+ 25
660
+ 26
661
+ 27
662
+ 28</pre>
663
+ </td>
664
+ <td>
665
+ <pre class="code"><span class="info file"># File 'lib/procreate/swatches/colors_helper.rb', line 20</span>
666
+
667
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_swatches_json'>to_swatches_json</span><span class='lparen'>(</span><span class='id identifier rubyid_color'>color</span><span class='rparen'>)</span>
668
+ <span class='id identifier rubyid_hsv_color'>hsv_color</span> <span class='op'>=</span> <span class='id identifier rubyid_color'>color</span><span class='period'>.</span><span class='id identifier rubyid_hsv'>hsv</span>
669
+
670
+ <span class='id identifier rubyid_hue'>hue</span> <span class='op'>=</span> <span class='id identifier rubyid_hsv_color'>hsv_color</span><span class='period'>.</span><span class='id identifier rubyid_h'>h</span> <span class='op'>/</span> <span class='int'>360</span>
671
+ <span class='id identifier rubyid_saturation'>saturation</span> <span class='op'>=</span> <span class='id identifier rubyid_hsv_color'>hsv_color</span><span class='period'>.</span><span class='id identifier rubyid_s'>s</span>
672
+ <span class='id identifier rubyid_brightness'>brightness</span> <span class='op'>=</span> <span class='id identifier rubyid_hsv_color'>hsv_color</span><span class='period'>.</span><span class='id identifier rubyid_v'>v</span>
673
+
674
+ <span class='id identifier rubyid_to_color_json'>to_color_json</span><span class='lparen'>(</span><span class='id identifier rubyid_hue'>hue</span><span class='comma'>,</span> <span class='id identifier rubyid_saturation'>saturation</span><span class='comma'>,</span> <span class='id identifier rubyid_brightness'>brightness</span><span class='rparen'>)</span>
675
+ <span class='kw'>end</span></pre>
676
+ </td>
677
+ </tr>
678
+ </table>
679
+ </div>
680
+
681
+ </div>
682
+
683
+ </div>
684
+
685
+ <div id="footer">
686
+ Generated on Sat Apr 27 09:32:32 2019 by
687
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
688
+ 0.9.16 (ruby-2.4.3).
689
+ </div>
690
+
691
+ </div>
692
+ </body>
693
+ </html>