13
13
SAMPLE USAGE:
14
14
{% from 'color_multi_tool.jinja' import random_name %}
15
15
{{- random_name() -}}
16
+
17
+ #### 🗿License Notice:
18
+ * I & my license require attribution as a link back to the original should
19
+ you use this code in your own creation.
20
+ * Here is a link to my license & the original github post
21
+ https://github.com/SirGoodenough/Color-Multi-Tool?tab=License-1-ov-file
22
+ expected to be followed & referenced
23
+ as attribution should you use this code elsewhere.
16
24
#}
17
25
{% - set _color_dict = _nameMap ._rgb | random %}
18
26
{{- _color_dict.color -}}
33
41
34
42
REMEMBER:
35
43
Everything returned from a macro template is a string.
44
+
45
+ #### 🗿License Notice:
46
+ * I & my license require attribution as a link back to the original should
47
+ you use this code in your own creation.
48
+ * Here is a link to my license & the original github post
49
+ https://github.com/SirGoodenough/Color-Multi-Tool?tab=License-1-ov-file
50
+ expected to be followed & referenced
51
+ as attribution should you use this code elsewhere.
36
52
#}
37
53
38
54
{% - set (X ,Y ) = [range (1001),range (1001)] | map ('random' ) | list %}
54
70
55
71
REMEMBER:
56
72
Everything returned from a macro template is a string.
73
+
74
+ #### 🗿License Notice:
75
+ * I & my license require attribution as a link back to the original should
76
+ you use this code in your own creation.
77
+ * Here is a link to my license & the original github post
78
+ https://github.com/SirGoodenough/Color-Multi-Tool?tab=License-1-ov-file
79
+ expected to be followed & referenced
80
+ as attribution should you use this code elsewhere.
57
81
#}
58
82
{% - set (H ,S ) = [range (36001),range (10001)] | map ('random' ) | list %}
59
83
{{- H/100 -}},{{- S/100 -}}
74
98
75
99
REMEMBER:
76
100
Everything returned from a macro template is a string.
101
+
102
+ #### 🗿License Notice:
103
+ * I & my license require attribution as a link back to the original should
104
+ you use this code in your own creation.
105
+ * Here is a link to my license & the original github post
106
+ https://github.com/SirGoodenough/Color-Multi-Tool?tab=License-1-ov-file
107
+ expected to be followed & referenced
108
+ as attribution should you use this code elsewhere.
77
109
#}
78
110
{% set (R ,G ,B ) = [range (256),range (256),range (256)] | map ('random' ) | list %}
79
111
{{- R -}},{{- G -}},{{- B -}}
99
131
100
132
REMEMBER:
101
133
Everything returned from a macro template is a string.
134
+
135
+ #### 🗿License Notice:
136
+ * I & my license require attribution as a link back to the original should
137
+ you use this code in your own creation.
138
+ * Here is a link to my license & the original github post
139
+ https://github.com/SirGoodenough/Color-Multi-Tool?tab=License-1-ov-file
140
+ expected to be followed & referenced
141
+ as attribution should you use this code elsewhere.
102
142
#}
103
143
{#- First a test to make sure input is valid #}
104
144
{% - if chkNAME (color_name ) | bool %}
133
173
134
174
REMEMBER:
135
175
Everything returned from a macro template is a string.
176
+
177
+ #### 🗿License Notice:
178
+ * I & my license require attribution as a link back to the original should
179
+ you use this code in your own creation.
180
+ * Here is a link to my license & the original github post
181
+ https://github.com/SirGoodenough/Color-Multi-Tool?tab=License-1-ov-file
182
+ expected to be followed & referenced
183
+ as attribution should you use this code elsewhere.
136
184
#}
137
185
{#- First a test to make sure input is valid #}
138
186
{% - if chkRGB (rgbl ) | default (false ) | bool %}
183
231
184
232
REMEMBER:
185
233
Everything returned from a macro template is a string.
234
+
235
+ #### 🗿License Notice:
236
+ * I & my license require attribution as a link back to the original should
237
+ you use this code in your own creation.
238
+ * Here is a link to my license & the original github post
239
+ https://github.com/SirGoodenough/Color-Multi-Tool?tab=License-1-ov-file
240
+ expected to be followed & referenced
241
+ as attribution should you use this code elsewhere.
186
242
#}
187
243
{#- First a test to make sure input is valid #}
188
244
{% - if chkRGB (rgbl ) | bool %}
252
308
253
309
REMEMBER:
254
310
Everything returned from a macro template is a string.
311
+
312
+ #### 🗿License Notice:
313
+ * I & my license require attribution as a link back to the original should
314
+ you use this code in your own creation.
315
+ * Here is a link to my license & the original github post
316
+ https://github.com/SirGoodenough/Color-Multi-Tool?tab=License-1-ov-file
317
+ expected to be followed & referenced
318
+ as attribution should you use this code elsewhere.
255
319
#}
256
320
{#- First a test to make sure input is valid #}
257
321
{% - if chkXY (xyl ) | bool %}
323
387
324
388
REMEMBER:
325
389
Everything returned from a macro template is a string.
390
+
391
+ #### 🗿License Notice:
392
+ * I & my license require attribution as a link back to the original should
393
+ you use this code in your own creation.
394
+ * Here is a link to my license & the original github post
395
+ https://github.com/SirGoodenough/Color-Multi-Tool?tab=License-1-ov-file
396
+ expected to be followed & referenced
397
+ as attribution should you use this code elsewhere.
326
398
#}
327
399
{#- First a test to make sure input is valid #}
328
400
{% - if chkHS (hsl ) | bool %}
391
463
Code lifted directly from the here November, 2023 at
392
464
https://www.cs.rit.edu/~ncs/color/t_convert.html#RGB%20to%20HSV%20&%20HSV%20to%20RGB.
393
465
Brightness is assumed to be 100%
394
-
466
+
395
467
SAMPLE USAGE:
396
468
{% from 'color_multi_tool.jinja' import rgb2hs %}
397
469
{% set _rgb2hs = rgb2hs(rgbl).split(",") | list %}
398
470
{{[ _rgb2hs[0]|float(0)|round(3),_rgb2hs[1]|float(0)|round(3)] }}
399
471
400
472
REMEMBER:
401
473
Everything returned from a macro template is a string.
474
+
475
+ #### 🗿License Notice:
476
+ * I & my license require attribution as a link back to the original should
477
+ you use this code in your own creation.
478
+ * Here is a link to my license & the original github post
479
+ https://github.com/SirGoodenough/Color-Multi-Tool?tab=License-1-ov-file
480
+ expected to be followed & referenced
481
+ as attribution should you use this code elsewhere.
402
482
#}
403
483
{#- First a test to make sure input is valid #}
404
484
{% - if chkRGB (rgbl ) | bool %}
464
544
465
545
REMEMBER:
466
546
Everything returned from a macro template is a string.
547
+
548
+ #### 🗿License Notice:
549
+ * I & my license require attribution as a link back to the original should
550
+ you use this code in your own creation.
551
+ * Here is a link to my license & the original github post
552
+ https://github.com/SirGoodenough/Color-Multi-Tool?tab=License-1-ov-file
553
+ expected to be followed & referenced
554
+ as attribution should you use this code elsewhere.
467
555
#}
468
556
{#- First a test to make sure input is valid #}
469
557
{% - if chkHS (hsl ) | bool %}
498
586
499
587
REMEMBER:
500
588
Everything returned from a macro template is a string.
589
+
590
+ #### 🗿License Notice:
591
+ * I & my license require attribution as a link back to the original should
592
+ you use this code in your own creation.
593
+ * Here is a link to my license & the original github post
594
+ https://github.com/SirGoodenough/Color-Multi-Tool?tab=License-1-ov-file
595
+ expected to be followed & referenced
596
+ as attribution should you use this code elsewhere.
501
597
#}
502
598
{#- First a test to make sure input is valid #}
503
599
{% - if chkXY (xyl ) | bool %}
@@ -535,6 +631,14 @@ Development credit to @Didgeridrew and @jeffcrum on the
535
631
REMEMBER:
536
632
This always returns text, so cast to bool on the other end to be
537
633
certain of the result.
634
+
635
+ #### 🗿License Notice:
636
+ * I & my license require attribution as a link back to the original should
637
+ you use this code in your own creation.
638
+ * Here is a link to my license & the original github post
639
+ https://github.com/SirGoodenough/Color-Multi-Tool?tab=License-1-ov-file
640
+ expected to be followed & referenced
641
+ as attribution should you use this code elsewhere.
538
642
#}
539
643
{% - if _rgbl is list and _rgbl | count == 3 %}
540
644
{% - for clr in _rgbl if is_number (clr ) and int (clr ,0) == clr and 0 <= clr <= 255 %}
@@ -564,6 +668,14 @@ Development credit to @123 on the
564
668
REMEMBER:
565
669
This always returns text, so cast to bool on the other end to be
566
670
certain of the result.
671
+
672
+ #### 🗿License Notice:
673
+ * I & my license require attribution as a link back to the original should
674
+ you use this code in your own creation.
675
+ * Here is a link to my license & the original github post
676
+ https://github.com/SirGoodenough/Color-Multi-Tool?tab=License-1-ov-file
677
+ expected to be followed & referenced
678
+ as attribution should you use this code elsewhere.
567
679
#}
568
680
{{- _xyl is list and
569
681
_xyl | select('number') | list | count == 2 and
@@ -591,6 +703,14 @@ Development credit to @123 on the
591
703
REMEMBER:
592
704
This always returns text, so cast to bool on the other end to be
593
705
certain of the result.
706
+
707
+ #### 🗿License Notice:
708
+ * I & my license require attribution as a link back to the original should
709
+ you use this code in your own creation.
710
+ * Here is a link to my license & the original github post
711
+ https://github.com/SirGoodenough/Color-Multi-Tool?tab=License-1-ov-file
712
+ expected to be followed & referenced
713
+ as attribution should you use this code elsewhere.
594
714
#}
595
715
{{- _hsl is list and
596
716
_hsl | select('number') | list | count == 2 and
@@ -616,6 +736,14 @@ If any is not true, return false.
616
736
REMEMBER:
617
737
This always returns text, so cast to bool on the other end to be
618
738
certain of the result.
739
+
740
+ #### 🗿License Notice:
741
+ * I & my license require attribution as a link back to the original should
742
+ you use this code in your own creation.
743
+ * Here is a link to my license & the original github post
744
+ https://github.com/SirGoodenough/Color-Multi-Tool?tab=License-1-ov-file
745
+ expected to be followed & referenced
746
+ as attribution should you use this code elsewhere.
619
747
#}
620
748
{% - if color_name is string_like and
621
749
color_name == color_name | regex_replace ('[^a-z]' , '' ) %}
@@ -647,6 +775,14 @@ If any is not true, return false.
647
775
SAMPLE USAGE:
648
776
{% from 'color_multi_tool.jinja' import color_list %}
649
777
{{- color_list().split('\n') | list -}}
778
+
779
+ #### 🗿License Notice:
780
+ * I & my license require attribution as a link back to the original should
781
+ you use this code in your own creation.
782
+ * Here is a link to my license & the original github post
783
+ https://github.com/SirGoodenough/Color-Multi-Tool?tab=License-1-ov-file
784
+ expected to be followed & referenced
785
+ as attribution should you use this code elsewhere.
650
786
#}
651
787
{% - for colors in _nameMap ._rgb -%}
652
788
{% - set c_list = {colors .color :[colors .r ,colors .g ,colors .b ]} -%}
0 commit comments