summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikzpingus/tikzpingus.sty
blob: 49e0e4365051af96bcb0eaa147c3c0ae1763c218 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
% Florian Sihler, 2022
% Licensed under GNU General Public License version 3
% https://opensource.org/licenses/gpl-3.0.html
\def\tikzpingus@filename{tikzpingus}
\ProvidesPackage{\tikzpingus@filename}[2022/08/24 version v1.0 Penguins in TikZ]
\newif\ifpengu@setup@glows@
\DeclareOption{glows}{\pengu@setup@glows@true}\DeclareOption{noglows}{\pengu@setup@glows@false}
\newif\ifpengu@setup@manual@layers@
\DeclareOption{manual-layers}{\pengu@setup@manual@layers@true}\DeclareOption{nomanual-layers}{\pengu@setup@manual@layers@false}
\newif\ifpengu@setup@bare@
\DeclareOption{bare}{\pengu@setup@bare@true}\DeclareOption{nobare}{\pengu@setup@bare@false}
\ProcessOptions*

\RequirePackage{etoolbox}
\RequirePackage{tikz}
\usetikzlibrary{intersections,shadings,patterns.meta,decorations.pathmorphing,shapes.symbols,shapes.geometric}

\pgfdeclarelayer{background}\pgfdeclarelayer{foreground}\pgfdeclarelayer{middle}
\pgfdeclarelayer{very-background}
\ifpengu@setup@manual@layers@\else
\pgfsetlayers{very-background,background,main,middle,foreground}
\fi
% #region whole setup
% #region colors
\def\@pingu@color@ #1#2(#3,#4,#5){\definecolor{pingu@#1}{#2}{#3,#4,#5}}
\@pingu@color@{main}RGB(3,14,29)
\@pingu@color@{black}RGB(23,19,19)
\@pingu@color@{silver}RGB(192,192,192)
\@pingu@color@{bronze}RGB(205,127,50)
\@pingu@color@{white}RGB(248,248,248)
\@pingu@color@{yellow}RGB(252,187,21)
\@pingu@color@{lightblue}RGB(174,229,243)
\@pingu@color@{blue}RGB(48,161,247)
\@pingu@color@{green}RGB(129,204,41)
\@pingu@color@{red}RGB(217, 40, 28)
\@pingu@color@{purple}RGB(244,48,93)
\def\@pingu@none{!hide}
% #endregion

% #region lengths and dimens
\newdimen\pingu@one@eight     \pingu@one@eight=.125cm % constants to save tokens
\newdimen\pingu@one           \pingu@one=1mm

\newdimen\pingu@w@half        \pingu@w@half=.9375cm
\newdimen\pingu@head@h@half   \pingu@head@h@half=.9\pingu@w@half
\newdimen\pingu@side@h@half   \pingu@side@h@half=1.275cm
\newdimen\pingu@bend          \pingu@bend=\pingu@one@eight
\newdimen\pingu@lower@off     \pingu@lower@off=.25cm
\newdimen\pingu@outer@off     \pingu@outer@off=.25cm
\def\basicfeetbend{45}
\newdimen\pingu@foot@outer@w  \pingu@foot@outer@w=4.5mm
\newdimen\pingu@foot@outer@h  \pingu@foot@outer@h=.25cm

\newdimen\pingu@headcon@x     \pingu@headcon@x=.39375cm% .75*.525cm
\newdimen\pingu@headcon@y     \pingu@headcon@y=.46735cm%.719*.65cm

\newdimen\pingu@foot@inner@w  \pingu@foot@inner@w=.55cm
\newdimen\pingu@foot@inner@h  \pingu@foot@inner@h=.115cm
\newdimen\pingu@foot@offset@w \pingu@foot@offset@w=-.125cm
\newdimen\pingu@foot@single@w \pingu@foot@single@w=.105cm
\newdimen\pingu@foot@single@h \pingu@foot@single@h=2mm
\def\eyebaseang{38.5}
\newdimen\pingu@eye@shift     \pingu@eye@shift=.8mm
\def\pinguanglehl{.93}
\def\pinguanglehr{.07}
% #endregion

% #region selections
\def\pingu@csappto#1#2{\expandafter\ifx\csname #1\endcsname\@empty\@namedef{#1}{#2}\else\expandafter\g@addto@macro\csname #1\endcsname{, #2}\fi}

\def\pingu@create@sel@err#1#2{%
    \PackageError{\tikzpingus@filename}{There is no '#2' drawer for '#1'. Choose one of '\@nameuse{@pingu@#1@}'}{Or ask the package maintainer :D}%
}

\def\pingu@@select#1#2{\expandafter\let\csname @pingu@drawer@#2@\expandafter\endcsname\csname @pingu@drawer@#2@#1@\endcsname
\expandafter\def\csname @pingu@select@#2@\expandafter\endcsname{#1}}

% #1 name | none default
\def\pingu@create@selection#1#2{%
    \expandafter\newcount\csname pc@#1@max\endcsname
    \expandafter\let\csname @pingu@#1@\endcsname\@empty
    \expandafter\long\expandafter\def\csname pingu@#1@add\endcsname##1##2{%
        \ifcsname @pingu@drawer@#1@##1@\endcsname\else% do not re-append!
        \pingu@csappto{@pingu@#1@}{"##1"}
        \expandafter\global\expandafter\advance\csname pc@#1@max\endcsname1\relax\fi
        \expandafter\long\expandafter\def\csname @pingu@drawer@#1@##1@\endcsname{##2}%
    }
    \expandafter\def\csname pingu@#1@select\endcsname##1{%
        \def\@tmp{##1}\ifx\@pingu@random\@tmp% if random is selected, we choose random from pack in @pingu@#1@
        % we could do this with pgfmathdeclarerandomlist, but this requires more,
        % at the moment, i do not care about efficiency, and we do a foreach
        % we do not pick none for random
        \edef\@arr{{\csname @pingu@#1@\endcsname}}%
        % we use 1 as minimum, because 0 is ALWAYS 'none' by definition
        \pgfmathrandominteger{\@ars}{1}{\csname pc@#1@max\endcsname-1}%
        \pgfmathsetmacro\@sel{\@arr[\@ars]}%
        \expandafter\pingu@@select\expandafter{\@sel}{#1}% consolidate the choice in case of multiple
        \else\ifcsname @pingu@drawer@#1@##1@\endcsname
            \pingu@@select{##1}{#1}%
        \else\pingu@create@sel@err{#1}{##1}\fi\fi
    }%
    \csname pingu@#1@add\endcsname{none}{#2}%
}
\def\@pingu@random{!random}

\long\def\pingu@create@extra#1#2#3{\expandafter\newif\csname if@pingu@x@#1@\endcsname\pgfqkeys{/pingu}{#2,extra defaults/.append style={#3}}}
\def\pingu@set@extra#1#2{\csname @pingu@x@#1@#2\endcsname}

\pingu@create@selection{lefteye}{%
    \path ([yshift=.75mm,xshift=\pingu@eye@shift]\pingu@name-eye-back-left) coordinate (\pingu@name-eye-left);%
}
\pingu@create@selection{righteye}{%
    \path ([yshift=.75mm,xshift=-\pingu@eye@shift]\pingu@name-eye-back-right) coordinate (\pingu@name-eye-right);%
}
\pingu@create@selection{leftwing}{%
    \path ([yshift=-6.5mm]\pingu@name-wings-side-left)
        coordinate (\pingu@name-wing-left-start)
        coordinate (\pingu@name-wing-left-tip)
        coordinate (\pingu@name-wing-left);%
}
\pingu@create@selection{rightwing}{%
    \path ([yshift=-6.5mm]\pingu@name-wings-side-right)
        coordinate (\pingu@name-wing-right-start)
        coordinate (\pingu@name-wing-right-tip)
        coordinate (\pingu@name-wing-right);%
}
\pingu@create@selection{hairstyle}{}
\pingu@create@selection{bill}{%
    \coordinate (\pingu@name-bill-bottom) at (\pingu@name-bill);%
}
\pingu@create@selection{leftfoot}{}
\pingu@create@selection{rightfoot}{}
\pingu@create@selection{bodytype}{\pingu@x@bodytype@none}
% #endregion

% #region key setup
\def\pingu@color#1#2{\expandafter\def\csname pingu@color@#1\endcsname{#2}}

% HACK: store scale
\pgfqkeys{/tikz}{scale/.append code={\def\pingu@default@scale{#1}}}
\def\pingu@default@scale{1}

\newif\if@pingu@draw@metadots
\newif\if@pingu@wi@flip@left
\newif\if@pingu@wi@flip@right
\newif\if@pingu@feet@front

\pgfqkeys{/pingu}{
  /pingu/.search also={/tikz,/pgf},
  name/.code                    = \def\pingu@name{#1},
  scale/.code                   = \def\pingu@scale{#1},
  @post/.code                   = \def\pingu@post{#1},
  @body@app/.code               = \def\pingu@body@app{#1},
  meta dots/.forward to         = /pingu/meta-dots,
  meta-dots/.is if              = @pingu@draw@metadots,
  meta-dots/.default            = true,
  @pingu@all/.style             = {},
  @block/.style                 = {/pingu/@pingu@all=#1, fill=#1},
  @draw/.style                  = {/pingu/@pingu@all=#1, cap=round, draw=#1},
  @text/.style                  = {transform shape,text=\pingu@color@body@main},
  @clip even odd rule/.code     = {\pgfseteorule}, % Credit to Andrew Stacey
  @invclip/.style               = {clip,insert path=[/pingu/@clip even odd rule]{[reset cm](-\maxdimen,-\maxdimen)rectangle(\maxdimen,\maxdimen)}},
  @pingu/.style = {}, @pingu@main/.style = {},
  % feet
  left foot color/.code         = \pingu@color{foot@left}{#1},
  left foot/.code               = \pingu@leftfoot@select{#1},
  right foot color/.code        = \pingu@color{foot@right}{#1},
  right foot/.code              = \pingu@rightfoot@select{#1},
  feet/.style                   = {/pingu/left foot={#1}, /pingu/right foot={#1}},
  feet color/.style             = {/pingu/left foot color={#1}, /pingu/right foot color={#1}},
  feet front/.is if             = @pingu@feet@front,
  % body
  body type/.code               = \pingu@bodytype@select{#1},
  body main/.code               = \pingu@color{body@main}{#1},
  body head/.code               = \pingu@color{body@head}{#1},
  body/.style                   = {/pingu/body main={#1}, /pingu/body head={#1}},
  body front/.code              = \pingu@color{body@front}{#1},
  % belly
  belly/.forward to             = /pingu/belly text,
  belly text/.style             = {/pingu/belly raw={\node[/pingu/@text,opacity=.2] {#1};}},
  belly raw/.code               = \def\pingu@belly@raw{#1},
  heart/.style                  = {/pingu/belly raw={\node[/pingu/@text,#1] {\Large\faHeart};}},
  % eyes
  left eye/.code                = \pingu@lefteye@select{#1},
  left eye color/.code          = \pingu@color{eye@left}{#1},
  left eye second color/.code   = \pingu@color{eye@second@left}{#1},
  right eye/.code               = \pingu@righteye@select{#1},
  right eye color/.code         = \pingu@color{eye@right}{#1},
  right eye second color/.code  = \pingu@color{eye@second@right}{#1},
  eyes/.style                   = {/pingu/left eye={#1}, /pingu/right eye={#1}},
  eyes color/.style             = {/pingu/left eye color={#1}, /pingu/right eye color={#1}},
  eyes second color/.style      = {/pingu/left eye second color={#1}, /pingu/right eye second color={#1}},
  % wings
  left wing color/.code         = \pingu@color{left@wing}{#1},
  left wing/.code               = \pingu@leftwing@select{#1},
  right wing color/.code        = \pingu@color{right@wing}{#1},
  right wing/.code              = \pingu@rightwing@select{#1},
  wings/.style                  = {/pingu/left wing={#1}, /pingu/right wing={#1}},
  wings color/.style            = {/pingu/left wing color={#1},
                                   /pingu/right wing color={#1}},
  left item angle/.forward to   = /pingu/left wing item angle,
  left wing item angle/.code    = {\def\pingu@wing@left@item@angle@user{#1}},%
  left item flip/.forward to    = /pingu/left wing item flip,
  left wing item flip/.is if    = @pingu@wi@flip@left,
  right item angle/.forward to  = /pingu/right wing item angle,
  right item flip/.forward to   = /pingu/right wing item flip,
  right wing item angle/.code   = {\def\pingu@wing@right@item@angle@user{#1}},%
  right wing item flip/.is if   = @pingu@wi@flip@right,
  % bill
  bill/.code                    = \pingu@bill@select{#1},
  bill color/.code              = \pingu@color{bill}{#1},
  % hair color TODO: other colors
  hair/.forward to              = /pingu/hairs color,
  hairs/.forward to             = /pingu/hairs color,
  hair 1 color/.code            = \pingu@color{hair@a}{#1}, hair 1/.forward to = /pingu/hair 1 color,
  hair 2 color/.code            = \pingu@color{hair@b}{#1}, hair 2/.forward to = /pingu/hair 2 color,
  hair 3 color/.code            = \pingu@color{hair@c}{#1}, hair 3/.forward to = /pingu/hair 3 color,
  hair 4 color/.code            = \pingu@color{hair@d}{#1}, hair 4/.forward to = /pingu/hair 4 color,
  hair 5 color/.code            = \pingu@color{hair@e}{#1}, hair 5/.forward to = /pingu/hair 5 color,
  hairs color/.style            = {/pingu/hair 1 color={#1},  /pingu/hair 2 color={#1}, /pingu/hair 3 color={#1},
                                   /pingu/hair 4 color={#1}, /pingu/hair 5 color={#1}},
  hair style/.forward to        = /pingu/hairstyle,
  hairstyle/.code               = \pingu@hairstyle@select{#1},
  % size
  height/.code                  = \setlength{\pingu@side@h@half}{#1},%
  small height/.forward to      = /pingu/small size, small/.forward to = /pingu/small size,
  small size/.style             = {/pingu/height=11mm},
  normal height/.forward to     = /pingu/normal size, normal/.forward to = /pingu/normal size,
  normal size/.style            = {/pingu/height=1.275cm},
  large height/.forward to      = /pingu/large size, large/.forward to = /pingu/large size,
  large size/.style             = {/pingu/height=15mm},
  random from/.code                  = {\pgfmathdeclarerandomlist{@tmp}{#1}\pgfmathrandomitem{\@tmp}{@tmp}\edef\tmp{\noexpand\@pingu@set{\@tmp}}\tmp},
  defaults/.style               = {%
    name=pingu, feet=normal, feet color=pingu@yellow, body=pingu@main,
    body type=normal,@post={},@body@app={},
    body front=pingu@white,%
    eyes=normal, eyes color=pingu@black, eyes second color=pingu@white,
    bill=normal, bill color=pingu@yellow,
    wings=normal, wings color=\pingu@color@body@main,
    hairstyle=normal, hairs color=\pingu@color@body@main,
    belly raw={}, scale=\pingu@default@scale,
    left wing item angle=0,right wing item angle=0,extra defaults,user defaults,%
    feet front=false%
  },
  user defaults/.style = {},
  % will be set individually
  extra defaults/.style = {}
}
\def\@pingu@set#1{\pgfqkeys{/pingu}{#1}}
\def\pingudefaults#1{\pgfqkeys{/pingu}{user defaults/.style={#1}}}
\def\pingudefaultsappend#1{\pgfqkeys{/pingu}{user defaults/.append style={#1}}}
% #endregion

% #region subenvs
\def\pingu@layer#1[#2]{\pgfonlayer{#1}\scope[/pingu/@pingu,#2]}
\def\endpingu@layer{\endscope\endpgfonlayer}
% #endregion

% #region complete sets and styles
\newif\if@pingu@do@back@
\pgfqkeys{/pingu}{
  :line/.style            = {/pingu/@block/.append style={fill=none,draw=##1!80!black,shade=none,path fading=none}},
  :fill/.style            = {/pingu/body=#1,/pingu/body front=#1,/pingu/feet color=#1, /pingu/bill color=#1, /pingu/eyes color=#1, /pingu/eyes second color=#1},
  :fill/.default          = pingu@main,
  :ghost parts/.style     = {/pingu/@pingu@all/.append style={opacity={#1}}},
  :ghost parts/.default   = {.5},
  :ghost/.style           = {/pingu/@pingu/.append style={opacity=#1,transparency group}},
  :ghost/.default         = {.5},
  :ghost glow/.style      = {/pingu/@pingu/.append style={opacity=#1,transparency group},/pingu/@block/.append style={/pingu/@glow}},
  :ghost glow/.default    = {.5},
  :devil/.style           = {/pingu/devil horns=#1,/pingu/eyes devil=#1},
  :devil/.default         = pingu@purple,
  :hide/.style            = {/pingu/body type=none,/pingu/hair=\@pingu@none,/pingu/feet=none,/pingu/wings=none,/pingu/bill=none,/pingu/eyes=none},
  :back/.code            = {\pgfqkeys{/pingu}{eyes=none,bill=none,body front=\pingu@color@body@main,@pingu@main/.append style={xshift=2\pingu@w@half,xscale=-1},feet back}\gdef\pingu@back@init@call{\pgfsetlayers{foreground,middle,main,background}\gdef\pingu@back@init@call{}}\@pingu@do@back@true}% TODO: back foot clipping?
}% TODO: draw another penguin that is then drawn above with only back
\let\pingu@back@init@call\@empty
% #endregion

% #region glows
\ifpengu@setup@glows@
\usetikzlibrary{fadings}%
\tikzfading[name=pingu@halo fade out,inner color=transparent!0,outer color=transparent!100]
\pgfqkeys{/pingu}{@glow/.style={path fading={pingu@halo fade out},#1}}
\else
\pgfqkeys{/pingu}{@glow/.style={},/pingu/@saber@glow/.style={}}
\fi
% #endregion
% #endregion

% #region core
%   #region path commands
\long\def\pingu@path{\@dblarg\pingu@path@}
\def\pingu@path@[#1]#2#3;{\protected@edef\@tmp{#2}\ifx\@tmp\@pingu@none\else\path[#1,#2] #3;\fi}
\long\def\pingu@block{\@dblarg\pingu@block@}
\def\pingu@block@[#1]#2#3;{\protected@edef\@tmp{#2}\ifx\@tmp\@pingu@none\else\path[#1,/pingu/@block=#2] #3;\fi}
\long\def\pingu@draw{\@dblarg\pingu@draw@}
\def\pingu@draw@[#1]#2#3;{\protected@edef\@tmp{#2}\ifx\@tmp\@pingu@none\else\path[#1,/pingu/@draw=#2] #3;\fi}
% #endregion

\newcommand*\pingu[1][]{%
\ifpengu@setup@manual@layers@\pgfsetlayers{background,main,middle,foreground}\fi\begingroup
\@pingu@do@back@false
\pgfqkeys{/pingu}{defaults, #1}%
\scope[/pingu/@pingu,/pingu/@pingu@main]
\@pingu@drawer@bodytype@
\pingu@body@app
\path (\pingu@name-head-center)++(0,-.05mm-\pingu@outer@off) coordinate (\pingu@name-bill);

\scope[shift=(\pingu@name-belly-center)]
\clip[use path=\pingu@whitepingu]; \pingu@belly@raw
\endscope
\coordinate (\pingu@name-head) at (\pingu@w@half,.7375cm);

\@pingu@drawer@lefteye@ \@pingu@drawer@righteye@

\pingu@layer{background}[]\pingu@draw@clothing@behind\endpingu@layer

\pingu@draw@clothing@middle
\pingu@draw@extras@below

\@pingu@drawer@hairstyle@
\if@pingu@feet@front\else\pingu@layer{background}[]\fi
\@pingu@drawer@leftfoot@ \@pingu@drawer@rightfoot@
\if@pingu@feet@front\else\endpingu@layer\fi

\@pingu@drawer@leftwing@ \@pingu@drawer@rightwing@

\path (\pingu@name-wing-left-start) -- (\pingu@name-wing-left) --
    ([turn]\csname @pingu@wingdown@\@pingu@select@leftwing@ @\endcsname:2.45mm)
    coordinate (\pingu@name-wing-left-low) -- ([turn]180:4.9mm)
    coordinate (\pingu@name-wing-left-up);
\path (\pingu@name-wing-left-start) -- (\pingu@name-wing-left) --
    (\pingu@name-wing-left-start) --
    ([turn]-180+\csname @pingu@wingdown@\@pingu@select@leftwing@ @\endcsname:3.45mm)
  coordinate (\pingu@name-wing-left-start-low) -- ([turn]180:6.9mm)
  coordinate (\pingu@name-wing-left-start-up);
\path (\pingu@name-wing-right-start) -- (\pingu@name-wing-right) --
    ([turn]-\csname @pingu@wingdown@\@pingu@select@rightwing@ @\endcsname:2.45mm)
    coordinate (\pingu@name-wing-right-low) -- ([turn]180:4.9mm)
    coordinate (\pingu@name-wing-right-up);
% double path to fix turn
\path (\pingu@name-wing-right-start) -- (\pingu@name-wing-right) --
      (\pingu@name-wing-right-start) --
      ([turn]180-\csname @pingu@wingdown@\@pingu@select@rightwing@ @\endcsname:3.45mm)
    coordinate (\pingu@name-wing-right-start-low) -- ([turn]180:6.9mm)
    coordinate (\pingu@name-wing-right-start-up);
\pingu@draw@clothing@main

\@pingu@drawer@bill@
\pingu@draw@extras@above
\pingu@draw@wing@items
\endscope
\if@pingu@draw@metadots \@pingu@draw@dots \fi
\pingu@post
\endgroup
\pingu@back@init@call
}
\let\pengu\pingu% as an alias

%   #region lower-pingu
% Note: to be used in clippies
\def\pingu@path@lowerpingu{(0,\pingu@outer@off)
% left side
to[bend right=\pingu@bend] ++(0,-\pingu@side@h@half-\pingu@outer@off)
% feety stuff
arc (180:270:\pingu@foot@outer@w{} and \pingu@foot@outer@h) arc (270:332:\pingu@foot@inner@w{} and \pingu@foot@inner@h)
arc (208:270:\pingu@foot@inner@w{} and \pingu@foot@inner@h) arc (270:360:\pingu@foot@outer@w{} and \pingu@foot@outer@h)%
% right side
to[bend right=\pingu@bend] ++(0,\pingu@side@h@half+\pingu@outer@off)
arc(0:180:\pingu@w@half{} and \pingu@head@h@half) -- cycle}% arc clip to secure wings
\def\pingu@path@upperpingu{(\pingu@name-head-center) ellipse [x radius=\pingu@w@half, y radius=\pingu@head@h@half]}

%   #endregion
% #endregion

% #region main body parts
% #region body front
% #region normal
\pingu@bodytype@add{normal}{%
\pingu@block[save path=\pingu@lowerpingu]{\pingu@color@body@main} (0,\pingu@outer@off)
% left side
to[bend right=\pingu@bend] coordinate[pos=.775] (\pingu@name-waist-right) ++(0,-\pingu@side@h@half-\pingu@outer@off)
% feety stuff
arc (180:270:\pingu@foot@outer@w{} and \pingu@foot@outer@h) coordinate (\pingu@name-foot-right)
arc (270:332:\pingu@foot@inner@w{} and \pingu@foot@inner@h)
coordinate (\pingu@name-bottom-center)
arc (208:270:\pingu@foot@inner@w{} and \pingu@foot@inner@h) coordinate (\pingu@name-foot-left)
arc (270:360:\pingu@foot@outer@w{} and \pingu@foot@outer@h)%
% right side
to[bend right=\pingu@bend] coordinate[pos=.225] (\pingu@name-waist-left) ++(0,\pingu@side@h@half+\pingu@outer@off)
% coordinate
coordinate (\pingu@name-wings-side-left)
-- (0,\pingu@outer@off) coordinate (\pingu@name-wings-side-right) coordinate[pos=.5] (\pingu@name-head-center) -- cycle;

\pingu@block[save path=\pingu@upperpingu]{\pingu@color@body@head} (\pingu@name-head-center)
++(0,\pingu@head@h@half) coordinate (\pingu@name-head-top)
arc(90:450:\pingu@w@half{} and \pingu@head@h@half)
coordinate[pos=\pinguanglehr] (\pingu@name-head-right)
coordinate[pos=\pinguanglehl] (\pingu@name-head-left);

\coordinate (\pingu@name-belly-back) at (\pingu@w@half,-1cm);
\coordinate (\pingu@name-belly-center) at (\pingu@w@half,-.68\pingu@side@h@half);
\pingu@block[save path=\pingu@whitepingu]{\pingu@color@body@front} (\pingu@name-belly-back)++(-\pingu@w@half+\pingu@one,\pingu@lower@off) to[bend right=.8\pingu@bend] ++(0,1.05cm-\pingu@side@h@half-\pingu@lower@off) arc (180:270:4mm and 2mm) arc (270:331:5mm and .85mm) arc (207:270:5mm and .85mm) arc (270:360:4mm and 2mm) to[bend right=.8\pingu@bend] ++(0,\pingu@side@h@half-1.05cm+\pingu@lower@off) arc (0:180:\pingu@w@half-.96mm and \pingu@w@half-\pingu@one) -- cycle;

\coordinate (\pingu@name-eye-back-right) at ([xshift=-.275cm,yshift=.25cm-\pingu@outer@off]\pingu@name-head-center);
\coordinate (\pingu@name-eye-back-left) at ([xshift=.275cm,yshift=.25cm-\pingu@outer@off]\pingu@name-head-center);

\coordinate (\pingu@name-head-back-con-right) at ([xshift=-\pingu@headcon@x,yshift=-\pingu@headcon@y]\pingu@name-eye-back-right);
\coordinate (\pingu@name-head-back-con-left) at ([xshift=\pingu@headcon@x,yshift=-\pingu@headcon@y]\pingu@name-eye-back-left);

\pingu@block{\pingu@color@body@front} (\pingu@name-eye-back-right)++(0,-.25mm) ellipse [x radius=.525cm,y radius=.625cm];
\pingu@block{\pingu@color@body@front} (\pingu@name-eye-back-left)++(0,-.25mm) ellipse [x radius=.525cm,y radius=.625cm];
}
% #endregion
% #region none
\def\pingu@x@bodytype@none{%
\path[save path=\pingu@lowerpingu] (0,\pingu@outer@off)
% left side
to[bend right=\pingu@bend] coordinate[pos=.775] (\pingu@name-waist-right) ++(0,-\pingu@side@h@half-\pingu@outer@off)
% feety stuff
arc (180:270:\pingu@foot@outer@w{} and \pingu@foot@outer@h) coordinate (\pingu@name-foot-right)
arc (270:332:\pingu@foot@inner@w{} and \pingu@foot@inner@h)
coordinate (\pingu@name-bottom-center)
arc (208:270:\pingu@foot@inner@w{} and \pingu@foot@inner@h) coordinate (\pingu@name-foot-left)
arc (270:360:\pingu@foot@outer@w{} and \pingu@foot@outer@h)%
% right side
to[bend right=\pingu@bend] coordinate[pos=.225] (\pingu@name-waist-left) ++(0,\pingu@side@h@half+\pingu@outer@off)
% coordinate
coordinate (\pingu@name-wings-side-left)
-- (0,\pingu@outer@off) coordinate (\pingu@name-wings-side-right) coordinate[pos=.5] (\pingu@name-head-center) -- cycle;

\path[save path=\pingu@upperpingu] (\pingu@name-head-center)
++(0,\pingu@head@h@half) coordinate (\pingu@name-head-top)
arc(90:450:\pingu@w@half{} and \pingu@head@h@half)
coordinate[pos=\pinguanglehr] (\pingu@name-head-right)
coordinate[pos=\pinguanglehl] (\pingu@name-head-left);

\coordinate (\pingu@name-belly-back) at (\pingu@w@half,-1cm);
\coordinate (\pingu@name-belly-center) at (\pingu@w@half,-.68\pingu@side@h@half);
\path[save path=\pingu@whitepingu] (\pingu@name-belly-back)++(-\pingu@w@half+\pingu@one,\pingu@lower@off) to[bend right=.8\pingu@bend] ++(0,1.05cm-\pingu@side@h@half-\pingu@lower@off) arc (180:270:4mm and 2mm) arc (270:331:5mm and .85mm) arc (207:270:5mm and .85mm) arc (270:360:4mm and 2mm) to[bend right=.8\pingu@bend] ++(0,\pingu@side@h@half-1.05cm+\pingu@lower@off) arc (0:180:\pingu@w@half-.96mm and \pingu@w@half-\pingu@one) -- cycle;

\coordinate (\pingu@name-eye-back-right) at ([xshift=-.275cm,yshift=.25cm-\pingu@outer@off]\pingu@name-head-center);
\coordinate (\pingu@name-eye-back-left) at ([xshift=.275cm,yshift=.25cm-\pingu@outer@off]\pingu@name-head-center);

\coordinate (\pingu@name-head-back-con-right) at ([xshift=-\pingu@headcon@x,yshift=-\pingu@headcon@y]\pingu@name-eye-back-right);
\coordinate (\pingu@name-head-back-con-left) at ([xshift=\pingu@headcon@x,yshift=-\pingu@headcon@y]\pingu@name-eye-back-left);
}
% #endregion
% #region chubby
\pingu@bodytype@add{chubby}{%
\pingu@block[save path=\pingu@lowerpingu]{\pingu@color@body@main} (0,\pingu@outer@off)
% left side
to[bend right=1.65*\pingu@bend] coordinate[pos=.775] (\pingu@name-waist-right) ++(0,-\pingu@side@h@half-\pingu@outer@off)
% feety stuff
arc (180:270:\pingu@foot@outer@w{} and \pingu@foot@outer@h-.35mm) coordinate (\pingu@name-foot-right)
arc (270:332:\pingu@foot@inner@w{} and 1.25*\pingu@foot@inner@h)
coordinate (\pingu@name-bottom-center)
arc (208:270:\pingu@foot@inner@w{} and 1.25*\pingu@foot@inner@h) coordinate (\pingu@name-foot-left)
arc (270:360:\pingu@foot@outer@w{} and \pingu@foot@outer@h-.35mm)%
% right side
to[bend right=1.65*\pingu@bend] coordinate[pos=.225] (\pingu@name-waist-left) ++(0,\pingu@side@h@half+\pingu@outer@off)
% coordinate
coordinate (\pingu@name-wings-side-left)
-- (0,\pingu@outer@off) coordinate (\pingu@name-wings-side-right) coordinate[pos=.5] (\pingu@name-head-center) -- cycle;

\pingu@block[save path=\pingu@upperpingu]{\pingu@color@body@head} (\pingu@name-head-center)
++(0,\pingu@head@h@half) coordinate (\pingu@name-head-top)
arc(90:450:\pingu@w@half{} and \pingu@head@h@half)
coordinate[pos=\pinguanglehr] (\pingu@name-head-right)
coordinate[pos=\pinguanglehl] (\pingu@name-head-left);

\coordinate (\pingu@name-belly-back) at (\pingu@w@half,-.97cm);
\coordinate (\pingu@name-belly-center) at (\pingu@w@half,-.65\pingu@side@h@half);
\pingu@block[save path=\pingu@whitepingu]{\pingu@color@body@front} (\pingu@name-head-center)++(-\pingu@w@half+2.5\pingu@one,-4.25mm) coordinate (@) to[bend right=19] ([xshift=-1.25mm,yshift=1.5\pingu@one]@|-\pingu@name-bottom-center) arc (180:270:4.675mm and 1mm) arc (270:331:4mm and 1.15mm) arc (207:270:4mm and 1.15mm) arc (270:360:4.675mm and 1mm) to[bend right=19] ([xshift=\pingu@w@half-2.5\pingu@one,yshift=-4.25mm]\pingu@name-head-center) ;

\coordinate (\pingu@name-eye-back-right) at ([xshift=-.275cm,yshift=.25cm-\pingu@outer@off]\pingu@name-head-center);
\coordinate (\pingu@name-eye-back-left) at ([xshift=.275cm,yshift=.25cm-\pingu@outer@off]\pingu@name-head-center);

\coordinate (\pingu@name-head-back-con-right) at ([xshift=-\pingu@headcon@x,yshift=-\pingu@headcon@y]\pingu@name-eye-back-right);
\coordinate (\pingu@name-head-back-con-left) at ([xshift=\pingu@headcon@x,yshift=-\pingu@headcon@y]\pingu@name-eye-back-left);

\pingu@block{\pingu@color@body@front} (\pingu@name-eye-back-right)++(0,-.5mm) ellipse [x radius=.525cm,y radius=.6cm];
\pingu@block{\pingu@color@body@front} (\pingu@name-eye-back-left)++(0,-.5mm) ellipse [x radius=.525cm,y radius=.6cm];
}
% #endregion
% #region legacy
\pingu@bodytype@add{legacy}{%
\pingu@block[save path=\pingu@lowerpingu]{\pingu@color@body@main} (0,\pingu@outer@off)
% left side
to[bend right=1.25*\pingu@bend] coordinate[pos=.77] (\pingu@name-waist-right) ++(0,-.95\pingu@side@h@half-\pingu@outer@off+.65\pingu@one) coordinate (@b) % for bottom clip
% feety stuff
to[out=270,in=270]
    coordinate[pos=.3,yshift=-.25mm] (\pingu@name-foot-right)
    coordinate[pos=.5,yshift=.875\pingu@one] (\pingu@name-bottom-center)
    coordinate[pos=.7,yshift=-.25mm] (\pingu@name-foot-left)
++(2*\pingu@w@half,0)
% right side
to[bend right=1.25*\pingu@bend] coordinate[pos=.225] (\pingu@name-waist-left) ++(0,.95\pingu@side@h@half+\pingu@outer@off-.65\pingu@one)
% coordinate
coordinate (\pingu@name-wings-side-left)
-- (0,\pingu@outer@off) coordinate (\pingu@name-wings-side-right) coordinate[pos=.5] (\pingu@name-head-center) -- cycle;

\pingu@block[save path=\pingu@upperpingu]{\pingu@color@body@head} (\pingu@name-head-center)
++(0,\pingu@head@h@half) coordinate (\pingu@name-head-top)
arc(90:450:\pingu@w@half{} and \pingu@head@h@half)
coordinate[pos=\pinguanglehr] (\pingu@name-head-right)
coordinate[pos=\pinguanglehl] (\pingu@name-head-left);

\coordinate (\pingu@name-belly-back) at (\pingu@w@half,-.97cm);
\coordinate (\pingu@name-belly-center) at (\pingu@w@half,-.75\pingu@side@h@half+.325\pingu@one);
\pingu@block[save path=\pingu@whitepingu]{\pingu@color@body@front} (\pingu@name-head-center)++(-\pingu@w@half+2.5\pingu@one,-4.25mm) coordinate (@) to[bend right=14] ([xshift=-1.25mm,yshift=.33\pingu@one]@|-@b) to[out=272,in=268] ++(2*\pingu@w@half-2.5\pingu@one,0) to[bend right=14] ([xshift=\pingu@w@half-2.5\pingu@one,yshift=-4.25mm]\pingu@name-head-center) ;

\coordinate (\pingu@name-eye-back-right) at ([xshift=-.275cm,yshift=.25cm-\pingu@outer@off]\pingu@name-head-center);
\coordinate (\pingu@name-eye-back-left) at ([xshift=.275cm,yshift=.25cm-\pingu@outer@off]\pingu@name-head-center);

\coordinate (\pingu@name-head-back-con-right) at ([xshift=-\pingu@headcon@x,yshift=-\pingu@headcon@y]\pingu@name-eye-back-right);
\coordinate (\pingu@name-head-back-con-left) at ([xshift=\pingu@headcon@x,yshift=-\pingu@headcon@y]\pingu@name-eye-back-left);

\pingu@block{\pingu@color@body@front} (\pingu@name-eye-back-right)++(0,-.5mm) ellipse [x radius=.525cm,y radius=.6cm];
\pingu@block{\pingu@color@body@front} (\pingu@name-eye-back-left)++(0,-.5mm) ellipse [x radius=.525cm,y radius=.6cm];
}
% #endregion
% #endregion
% #region eyes
% name core | left | right
\long\def\@pingu@eyes@s#1#2#3{\@ifnextchar[{\@pingu@eyes@s@{#1}{#2}{#3}}{\@pingu@eyes@s@{#1}{#2}{#3}[pingu@black]}}
\long\def\@pingu@eyes@s@#1#2#3[#4]{%
    \pgfqkeys{/pingu}{%
        left eye #1/.style = {/pingu/left eye={#1}, /pingu/left eye color={##1}},%
        left eye #1/.default = {#4},%
        right eye #1/.style = {/pingu/right eye={#1}, /pingu/right eye color={##1}},%
        right eye #1/.default = {#4},%
        eyes #1/.style = {/pingu/eyes={#1}, /pingu/eyes color={##1}},%
        eyes #1/.default = {#4}%
    }%
    \pingu@lefteye@add{#1}{#2}\pingu@righteye@add{#1}{#3}%
}
\pgfqkeys{/pingu}{eyes none/.style={eyes=none},left eye none/.style={left eye=none},right eye none/.style={right eye=none}} % adding the alias

\@pingu@eyes@s{normal}{%
    \pingu@block{\pingu@color@eye@left} ([yshift=.75mm,xshift=\pingu@eye@shift]\pingu@name-eye-back-left) coordinate (\pingu@name-eye-left) ellipse [x radius=.1225cm, y radius=.1365cm];
}{%
    \pingu@block{\pingu@color@eye@right} ([yshift=.75mm,xshift=-\pingu@eye@shift]\pingu@name-eye-back-right) coordinate(\pingu@name-eye-right) ellipse [x radius=.1225cm, y radius=.1365cm];
}

\@pingu@eyes@s{vertical}{%
    \pingu@block{\pingu@color@eye@left} ([yshift=.75mm,xshift=\pingu@eye@shift]\pingu@name-eye-back-left) coordinate (\pingu@name-eye-left) ellipse [x radius=1.13mm, y radius=.145cm];
}{%
    \pingu@block{\pingu@color@eye@right} ([yshift=.75mm,xshift=-\pingu@eye@shift]\pingu@name-eye-back-right) coordinate(\pingu@name-eye-right) ellipse [x radius=1.13mm, y radius=.145cm];
}

\@pingu@eyes@s{shiny}{%
    \pingu@block{\pingu@color@eye@left} ([yshift=.75mm,xshift=\pingu@eye@shift]\pingu@name-eye-back-left) coordinate(\pingu@name-eye-left) ellipse [x radius=.22cm, y radius=.26cm];
    \pingu@block{\pingu@color@eye@second@left} (\pingu@name-eye-left)++(\eyebaseang:.85mm and \pingu@one) ellipse [x radius=.8mm, y radius=\pingu@one];
    \pingu@block{\pingu@color@eye@second@left} (\pingu@name-eye-left)++(\eyebaseang+180:.12cm and .14cm) ellipse [x radius=.25mm, y radius=.35mm];
}{%
    \pingu@block{\pingu@color@eye@right} ([yshift=.75mm,xshift=-\pingu@eye@shift]\pingu@name-eye-back-right) coordinate(\pingu@name-eye-right) ellipse [x radius=.22cm, y radius=.26cm];
    \pingu@block{\pingu@color@eye@second@right} (\pingu@name-eye-right)++(\eyebaseang:.85mm and \pingu@one) ellipse [x radius=.8mm, y radius=\pingu@one];
    \pingu@block{\pingu@color@eye@second@right} (\pingu@name-eye-right)++(\eyebaseang+180:.12cm and .14cm) ellipse [x radius=.25mm, y radius=.35mm];
}

\@pingu@eyes@s{wink}{%
    \coordinate (\pingu@name-eye-left) at ([yshift=.75mm,xshift=\pingu@eye@shift]\pingu@name-eye-back-left);
    \pingu@block[rounded corners=.002cm,rotate around={-4:(\pingu@name-eye-left)}]{\pingu@color@eye@left} (\pingu@name-eye-left)++(174:.14cm and .14cm)++(0,-.065cm) arc (174:6:.14cm and .14cm) arc (-6:-174:.1mm and .08mm) arc (6:174:.12cm and .065cm) arc (-6:-174:.1mm and .08mm) -- cycle;
}{%
    \coordinate (\pingu@name-eye-right) at ([yshift=.75mm,xshift=-\pingu@eye@shift]\pingu@name-eye-back-right);
    \pingu@block[rounded corners=.002cm,rotate around={4:(\pingu@name-eye-right)}]{\pingu@color@eye@right} (\pingu@name-eye-right)++(174:.14cm and .14cm)++(0,-.065cm) arc (174:6:.14cm and .14cm) arc (-6:-174:.1mm and .08mm) arc (6:174:.12cm and .065cm) arc (-6:-174:.1mm and .08mm) -- cycle;
}

\@pingu@eyes@s{shock}{%
    \pingu@block{\pingu@color@eye@left} ([yshift=.75mm,xshift=\pingu@eye@shift]\pingu@name-eye-back-left) coordinate (\pingu@name-eye-left) ellipse [x radius=.1535cm, y radius=.1575cm];
    \pingu@block{\pingu@color@eye@second@left} ([yshift=.75mm,xshift=\pingu@eye@shift]\pingu@name-eye-back-left) coordinate (\pingu@name-eye-left) ellipse [x radius=.1325cm, y radius=.1375cm];
}{%
    \pingu@block{\pingu@color@eye@right} ([yshift=.75mm,xshift=-\pingu@eye@shift]\pingu@name-eye-back-right) coordinate(\pingu@name-eye-right) ellipse [x radius=.1535cm, y radius=.1575cm];
    \pingu@block{\pingu@color@eye@second@right} ([yshift=.75mm,xshift=-\pingu@eye@shift]\pingu@name-eye-back-right) coordinate(\pingu@name-eye-right) ellipse [x radius=.1325cm, y radius=.1375cm];
}

% \let\@pingu@eyes@s\relax
% #endregion

% #region wings
% every wing has to define 1) a base element angle and 2) a marker if before or after the wing
\let\pingu@wi@above\iftrue
\let\pingu@wi@below\iffalse
% name core | left | right | above: \iftrue | angle for items | wing down [left]
\long\def\@pingu@wings@s#1#2#3#4#5#6{%
    \pgfqkeys{/pingu}{%
        left wing #1/.style   = {/pingu/left wing={#1}, /pingu/left wing color={##1}},%
        left wing #1/.default = \pingu@color@body@main,%
        right wing #1/.style   = {/pingu/right wing={#1}, /pingu/right wing color={##1}},%
        right wing #1/.default = \pingu@color@body@main,%
        wings #1/.style   = {/pingu/wings={#1}, /pingu/wings color={##1}},%
        wings #1/.default = \pingu@color@body@main%
    }%
    \expandafter\def\csname @pingu@wing@str@#1@\endcsname{#1}%
    \pingu@leftwing@add{#1}{#2}\pingu@rightwing@add{#1}{#3}%
    \expandafter\let\csname @pingu@wingitem@#1@\endcsname#4\relax
    \expandafter\def\csname @pingu@wingangle@items@#1@\endcsname{#5}%
    \expandafter\def\csname @pingu@wingdown@#1@\endcsname{#6}%
}
\pgfqkeys{/pingu}{wings none/.style={/pingu/wings=none},left wing none/.style={/pingu/left wing=none},right wing none/.style={/pingu/right wing=none}} % adding the alias
\let\@pingu@wingitem@none@\pingu@wi@above
\def\@pingu@wingangle@items@none@{90}
\def\@pingu@wingdown@none@{90}

%     #region wings-normal
\@pingu@wings@s{normal}{%
    \coordinate (\pingu@name-wing-left-start) at ([yshift=-6.5mm]\pingu@name-wings-side-left);
\scope[xshift=-\p@] % shift to avoid rounding errors in pdf viewers
    \pgfinterruptboundingbox
    \path[/pingu/@invclip] \pingu@path@lowerpingu;
    \endpgfinterruptboundingbox
    \pingu@block[rotate around={15:(\pingu@name-wing-left-start)}]{\pingu@color@left@wing} (\pingu@name-wing-left-start) ellipse [x radius=.195cm, y radius=9mm] +(-90:.195cm and 9mm) coordinate (\pingu@name-wing-left-tip) +(-90:.145cm and .75cm) coordinate (\pingu@name-wing-left);
\endscope}{%
\coordinate (\pingu@name-wing-right-start) at ([yshift=-6.5mm]\pingu@name-wings-side-right);
\scope[xshift=\p@] % shift to avoid rounding errors in pdf viewers
    \pgfinterruptboundingbox
    \path[/pingu/@invclip] \pingu@path@lowerpingu;
    \endpgfinterruptboundingbox
    \pingu@block[rotate around={-15:(\pingu@name-wing-right-start)}]{\pingu@color@right@wing} (\pingu@name-wing-right-start) ellipse [x radius=.195cm, y radius=9mm] +(-90:.195cm and 9mm) coordinate (\pingu@name-wing-right-tip) +(-90:.145cm and .75cm) coordinate (\pingu@name-wing-right);
\endscope}{\pingu@wi@above}{-5}{-70}
%     #endregion
%     #region wings-wave
\@pingu@wings@s{wave}{%
    \coordinate (\pingu@name-wing-left-start) at ([yshift=-5.85mm]\pingu@name-wings-side-left);
    \scope[xshift=-\p@] % shift to avoid rounding errors in pdf viewers
    \pgfinterruptboundingbox
    \path[/pingu/@invclip] \pingu@path@lowerpingu;
    \endpgfinterruptboundingbox
    \pingu@block[rotate around={-39:(\pingu@name-wing-left-start)}]{\pingu@color@left@wing} (\pingu@name-wing-left-start) ellipse [x radius=2.2mm, y radius=9.35mm] +(90:.22cm and .935cm) coordinate (\pingu@name-wing-left-tip) +(150:.22cm and .935cm) coordinate (\pingu@name-wing-left-cap-up) +(-3:.22cm and .935cm) coordinate (\pingu@name-wing-left-cap-down) +(90:.175cm and .75cm) coordinate (\pingu@name-wing-left);
    \pingu@block{\pingu@color@left@wing} (\pingu@name-wing-left-start)++(.03mm,4.6mm) to[out=-80,in=220] (\pingu@name-wing-left-cap-up) -- (\pingu@name-wing-left-start) -- cycle;
    \pingu@block{\pingu@color@left@wing} (\pingu@name-wing-left-start)++(.085mm,-4.4mm) to[out=80,in=-131] (\pingu@name-wing-left-cap-down) -- (\pingu@name-wing-left-start) -- cycle;
    \endscope}{%
    \coordinate (\pingu@name-wing-right-start) at ([yshift=-5.85mm]\pingu@name-wings-side-right);
\scope[xshift=\p@] % shift to avoid rounding errors in pdf viewers
    \pgfinterruptboundingbox
    \path[/pingu/@invclip] \pingu@path@lowerpingu;
    \endpgfinterruptboundingbox
    \pingu@block[rotate around={39:(\pingu@name-wing-right-start)}]{\pingu@color@right@wing} (\pingu@name-wing-right-start) ellipse [x radius=.22cm, y radius=.935cm] +(90:.22cm and .935cm) coordinate (\pingu@name-wing-right-tip) +(30:.22cm and .935cm) coordinate (\pingu@name-wing-right-cap-up) +(177:.22cm and .935cm) coordinate (\pingu@name-wing-right-cap-down) +(90:.175cm and .775cm) coordinate (\pingu@name-wing-right);
    \pingu@block{\pingu@color@right@wing} (\pingu@name-wing-right-start)++(-.03mm,4.6mm) to[out=-100,in=-45] (\pingu@name-wing-right-cap-up) -- (\pingu@name-wing-right-start) -- cycle;
    \pingu@block{\pingu@color@right@wing} (\pingu@name-wing-right-start)++(-.1mm,-4.4mm) to[out=100,in=-50] (\pingu@name-wing-right-cap-down) -- (\pingu@name-wing-right-start) -- cycle;
\endscope}{\pingu@wi@above}{-10}{-110}
%     #endregion
%     #region wings-raise
\@pingu@wings@s{raise}{%
\coordinate (\pingu@name-wing-left-start) at ([yshift=-6.25mm]\pingu@name-wings-side-left);
\scope[xshift=-\p@] % shift to avoid rounding errors in pdf viewers
\pgfinterruptboundingbox
\path[/pingu/@invclip] \pingu@path@lowerpingu;
\endpgfinterruptboundingbox
    \pingu@block[rotate around={-17:(\pingu@name-wing-left-start)}]{\pingu@color@left@wing} (\pingu@name-wing-left-start) ellipse [x radius=.195cm, y radius=.925cm] +(90:.195cm and .925cm) coordinate (\pingu@name-wing-left-tip) +(90:.145cm and .775cm) coordinate (\pingu@name-wing-left);
\endscope}{%
\scope[xshift=\p@] % shift to avoid rounding errors in pdf viewers
    \pgfinterruptboundingbox
    \path[/pingu/@invclip] \pingu@path@lowerpingu;
    \endpgfinterruptboundingbox
    \coordinate (\pingu@name-wing-right-start) at ([yshift=-6.25mm]\pingu@name-wings-side-right);
    \pingu@block[rotate around={17:(\pingu@name-wing-right-start)}]{\pingu@color@right@wing} (\pingu@name-wing-right-start) ellipse [x radius=.195cm, y radius=.925cm] +(90:.195cm and .925cm) coordinate (\pingu@name-wing-right-tip) +(90:.145cm and .775cm) coordinate (\pingu@name-wing-right);
\endscope}%
{\pingu@wi@above}{0}{-126}
%     #endregion
%     #region wings-grab
\@pingu@wings@s{grab}{%
\pingu@layer{foreground}[]
    \clip[use path=\pingu@lowerpingu];
    \coordinate (\pingu@name-wing-left-start) at ([yshift=-4.5mm]\pingu@name-wings-side-left);
    \pingu@block[rotate around={-42:(\pingu@name-wing-left-start)}]{\pingu@color@left@wing} (\pingu@name-wing-left-start) ellipse [x radius=.225cm, y radius=1.05cm] +(-90:.225cm and 1.05cm) coordinate (\pingu@name-wing-left-tip) +(-90:.175cm and 9mm) coordinate (\pingu@name-wing-left);
\endpingu@layer}{%
\pingu@layer{foreground}[]
    \clip[use path=\pingu@lowerpingu];
    \coordinate (\pingu@name-wing-right-start) at ([yshift=-4.5mm]\pingu@name-wings-side-right);
    \pingu@block[rotate around={42:(\pingu@name-wing-right-start)}]{\pingu@color@right@wing} (\pingu@name-wing-right-start) ellipse [x radius=.225cm, y radius=1.05cm] +(-90:.225cm and 1.05cm) coordinate (\pingu@name-wing-right-tip) +(-90:.175cm and 9mm) coordinate (\pingu@name-wing-right);
\endpingu@layer}%
{\pingu@wi@below}{12}{60}
%     #endregion
%     #region wings-shock
\@pingu@wings@s{shock}{%
\pingu@layer{foreground}[]
    \clip[use path=\pingu@lowerpingu];
    \coordinate (\pingu@name-wing-left-start) at ([yshift=-6.5mm]\pingu@name-wings-side-left);
    \pingu@block[rotate around={64:(\pingu@name-wing-left-start)}]{\pingu@color@left@wing} (\pingu@name-wing-left-start) ellipse [x radius=.235cm, y radius=.85cm] +(90:.235cm and .85cm) coordinate (\pingu@name-wing-left-tip) +(90:.185cm and .7cm) coordinate (\pingu@name-wing-left);
\endpingu@layer}{%
\pingu@layer{foreground}[]
    \clip[use path=\pingu@lowerpingu];
    \coordinate (\pingu@name-wing-right-start) at ([yshift=-6.5mm]\pingu@name-wings-side-right);
    \pingu@block[rotate around={-64:(\pingu@name-wing-right-start)}]{\pingu@color@right@wing} (\pingu@name-wing-right-start) ellipse [x radius=.235cm, y radius=.85cm] +(90:.235cm and .85cm) coordinate (\pingu@name-wing-right-tip) +(90:.185cm and .7cm) coordinate (\pingu@name-wing-right);
\endpingu@layer}%
{\pingu@wi@below}{-180}{116}
%     #endregion
%     #region wings-hug
\@pingu@wings@s{hug}{%
\coordinate (\pingu@name-wing-left-start) at ([yshift=-6.25mm]\pingu@name-wings-side-left);
\scope[xshift=-\p@] % shift to avoid rounding errors in pdf viewers
\pgfinterruptboundingbox
\path[/pingu/@invclip] \pingu@path@lowerpingu;
\endpgfinterruptboundingbox
\pingu@block[rotate around={-128:(\pingu@name-wing-left-start)}]{\pingu@color@left@wing} (\pingu@name-wing-left-start) ellipse [x radius=.235cm, y radius=.925cm] +(90:.235cm and .935cm) coordinate (\pingu@name-wing-left-tip) +(175:.235cm and .935cm) coordinate (\pingu@name-wing-left-cap-up) +(22:.235cm and .935cm) coordinate (\pingu@name-wing-left-cap-down) +(90:.175cm and .775cm) coordinate (\pingu@name-wing-left);
\pingu@block{\pingu@color@left@wing} (\pingu@name-wing-left-start)++(.03mm,4.6mm) to[out=-80,in=140] (\pingu@name-wing-left-cap-up) -- (\pingu@name-wing-left-start) -- cycle;
\pingu@block{\pingu@color@left@wing} (\pingu@name-wing-left-start)++(.085mm,-4.4mm) to[out=82,in=155] (\pingu@name-wing-left-cap-down) -- (\pingu@name-wing-left-start) -- cycle;
\endscope}{%
\coordinate (\pingu@name-wing-right-start) at ([yshift=-6.25mm]\pingu@name-wings-side-right);
\scope[xshift=\p@] % shift to avoid rounding errors in pdf viewers
\pgfinterruptboundingbox
\path[/pingu/@invclip] \pingu@path@lowerpingu;
\endpgfinterruptboundingbox
\pingu@block[rotate around={128:(\pingu@name-wing-right-start)}]{\pingu@color@right@wing} (\pingu@name-wing-right-start) ellipse [x radius=.235cm, y radius=.935cm] +(90:.235cm and .935cm) coordinate (\pingu@name-wing-right-tip) +(5:.235cm and .935cm) coordinate (\pingu@name-wing-right-cap-up) +(160:.235cm and .935cm) coordinate (\pingu@name-wing-right-cap-down) +(90:.175cm and .775cm) coordinate (\pingu@name-wing-right);
\pingu@block{\pingu@color@right@wing} (\pingu@name-wing-right-start)++(-.03mm,4.6mm) to[out=-100,in=40] (\pingu@name-wing-right-cap-up) -- (\pingu@name-wing-right-start) -- cycle;
\pingu@block{\pingu@color@right@wing} (\pingu@name-wing-right-start)++(-.085mm,-4.4mm) to[out=92,in=20] (\pingu@name-wing-right-cap-down) -- (\pingu@name-wing-right-start) -- cycle;
\endscope}{\pingu@wi@above}{-30}{-62}
\let\@pingu@wings@s\relax
%     #endregion
% #endregion

% #region hairstyle
\pgfqkeys{/pingu}{hairstyle none/.style={/pingu/hairstyle=none}}
\pingu@hairstyle@add{normal}{%
\scope\pgfinterruptboundingbox
\clip[/pingu/@invclip] (\pingu@name-head-center) ellipse [x radius=\pingu@w@half, y radius=\pingu@head@h@half-.0165mm];
\endpgfinterruptboundingbox
\scope[rounded corners=.08mm]
\pingu@block{\pingu@color@hair@a} ([yshift=-\pingu@one]\pingu@name-head-top) -- ++(.15mm,0) arc (0:90:\pingu@one@eight{} and .135cm) arc (90:0:.35mm and .75mm);
\pingu@block{\pingu@color@hair@b} ([yshift=-\pingu@one]\pingu@name-head-top) -- ++(.33mm,0) arc (0:90:\pingu@one@eight{} and .175cm) arc (90:0:.35mm and \pingu@one);
\pingu@block{\pingu@color@hair@c} ([yshift=-\pingu@one]\pingu@name-head-top) -- ++(-.33mm,0) arc (180:90:.17cm and .215cm) arc (90:180:.75mm and .18cm);
\pingu@block{\pingu@color@hair@d} ([yshift=-\pingu@one]\pingu@name-head-top) -- ++(.25mm,0) arc (180:90:\pingu@one@eight{} and .175cm) arc (90:180:.35mm and \pingu@one@eight);
\pingu@block{\pingu@color@hair@e} ([yshift=-\pingu@one]\pingu@name-head-top) -- ++(.44mm,0) arc (180:90:\pingu@one@eight{} and .135cm) arc (90:180:.35mm and .75mm);
\endscope\endscope}
% #endregion

% #region feet
\long\def\@pingu@feet@s#1#2#3{\@ifnextchar[{\@pingu@feet@s@{#1}{#2}{#3}}{\@pingu@feet@s@{#1}{#2}{#3}[pingu@yellow]}}
\long\def\@pingu@feet@s@#1#2#3[#4]{%
    \pgfqkeys{/pingu}{%
        left foot #1/.style    = {/pingu/left foot={#1}, /pingu/left foot color={##1}},%
        left foot #1/.default  = {#4},%
        right foot #1/.style   = {/pingu/right foot={#1}, /pingu/right foot color={##1}},%
        right foot #1/.default = {#4},%
        feet #1/.style         = {/pingu/feet={#1}, /pingu/feet color={##1}},%
        feet #1/.default       = {#4}%
    }%
    \pingu@leftfoot@add{#1}{#2}\pingu@rightfoot@add{#1}{#3}%
}
\pgfqkeys{/pingu}{feet none/.style={/pingu/feet=none}, /left foot none/.style={/pingu/left foot=none}, right foot none/.style={/pingu/right foot=none}}

\@pingu@feet@s{normal}{%
    \coordinate (@tmp) at ([xshift=-.5\pingu@foot@single@h]\pingu@name-foot-left);
    \pingu@block[rotate around={-25+\basicfeetbend:(@tmp)}]{\pingu@color@foot@left} (@tmp) ellipse [x radius=\pingu@foot@single@w,y radius=\pingu@foot@single@h];
    \pingu@block[rotate around={\basicfeetbend:(\pingu@name-foot-left)}]{\pingu@color@foot@left} (\pingu@name-foot-left) ellipse [x radius=\pingu@foot@single@w,y radius=\pingu@foot@single@h];
    \coordinate (@tmp) at ([xshift= .5\pingu@foot@single@h]\pingu@name-foot-left);
    \pingu@block[rotate around={25+\basicfeetbend:(@tmp)}]{\pingu@color@foot@left} (@tmp) ellipse [x radius=\pingu@foot@single@w,y radius=\pingu@foot@single@h];
}{%
    \coordinate (@tmp) at ([xshift=-.5\pingu@foot@single@h]\pingu@name-foot-right);
    \pingu@block[rotate around={-25-\basicfeetbend:(@tmp)}]{\pingu@color@foot@right} (@tmp) ellipse [x radius=\pingu@foot@single@w,y radius=\pingu@foot@single@h];
    \pingu@block[rotate around={-\basicfeetbend:(\pingu@name-foot-right)}]{\pingu@color@foot@right} (\pingu@name-foot-right) ellipse [x radius=\pingu@foot@single@w,y radius=\pingu@foot@single@h];
    \coordinate (@tmp) at ([xshift= .5\pingu@foot@single@h]\pingu@name-foot-right);
    \pingu@block[rotate around={25-\basicfeetbend:(@tmp)}]{\pingu@color@foot@right} (@tmp) ellipse [x radius=\pingu@foot@single@w,y radius=\pingu@foot@single@h];
}


\@pingu@feet@s{sit}{%
\pingu@layer{foreground}[]
    \coordinate (@tmp) at ([xshift=-.35\pingu@foot@single@h,yshift=-.4mm]\pingu@name-foot-left);
    \pingu@block[rotate around={\basicfeetbend:(@tmp)}]{\pingu@color@foot@left} (@tmp)
    arc(180:90:1.33mm and 4mm) arc (90:0:1.33mm and .9mm) to[bend left=50] ++(1.33mm,-1.3mm) to[bend left=66] ++(.7mm,-1.8mm) arc(0-50:-90-20:4.13mm and 4.2mm) to[bend left] cycle;
\endpingu@layer
}{%
\pingu@layer{foreground}[xscale=-1]
    \coordinate (@tmp) at ([xshift=-.35\pingu@foot@single@h,yshift=-.5mm]\pingu@name-foot-right);
    \pingu@block[rotate around={\basicfeetbend:(@tmp)}]{\pingu@color@foot@right} (@tmp)
    arc(180:90:1.33mm and 4mm) arc (90:0:1.33mm and .9mm) to[bend left=50] ++(1.33mm,-1.3mm) to[bend left=66] ++(.7mm,-1.8mm) arc(0-50:-90-20:4.13mm and 4.2mm) to[bend left] cycle;
\endpingu@layer
}

\@pingu@feet@s{simple}{%
    \pingu@block[rotate around={-\basicfeetbend:(\pingu@name-foot-left)}]{\pingu@color@foot@left} (\pingu@name-foot-left) ellipse [x radius=2.66\pingu@foot@single@w,y radius=\pingu@foot@single@h];
}{%
    \pingu@block[rotate around={\basicfeetbend:(\pingu@name-foot-right)}]{\pingu@color@foot@right} (\pingu@name-foot-right) ellipse [x radius=2.66\pingu@foot@single@w,y radius=\pingu@foot@single@h];
}

\@pingu@feet@s{back}{%
    \pingu@block{\pingu@color@foot@left} ([yshift=.2\pingu@foot@single@h]\pingu@name-foot-left) ellipse [x radius=2.5\pingu@foot@single@w,y radius=.435\pingu@foot@single@h];
}{%
    \pingu@block{\pingu@color@foot@right} ([yshift=.2\pingu@foot@single@h]\pingu@name-foot-right) ellipse [x radius=2.5\pingu@foot@single@w,y radius=.435\pingu@foot@single@h];
}

\@pingu@feet@s{chubby}{%
\pingu@layer{foreground}[rotate around={-\basicfeetbend+45:(\pingu@name-foot-left)}]
    \pingu@block\pingu@color@foot@left ([xshift=-3mm,yshift=-1.65mm]\pingu@name-foot-left) to[bend right=3] ++(5mm,0) -- ++(.05mm,.6mm) to[out=83,in=129,looseness=1.125] cycle;
    \ifx\pingu@color@foot@left\@pingu@none\else
        \colorlet{@}{\pingu@color@foot@left!80!\pingu@color@body@main}
        \pingu@draw{@} ([xshift=-3mm,yshift=-1.65mm]\pingu@name-foot-left) to[bend right=5] coordinate[pos=.29] (@) coordinate[pos=.69] (@b) ++(5mm,0) -- ++(.05mm,.6mm) to[out=83,in=119,looseness=1.125] cycle;
        \pingu@draw{@} (@) to[bend right=4] ++(.125mm,.75mm);
        \pingu@draw{@} (@b) to[bend right=9] ++(.15mm,1.15mm);
    \fi
\endpingu@layer
}{%
\pingu@layer{foreground}[rotate around={-\basicfeetbend+45:(\pingu@name-foot-right)}]
    \pingu@block\pingu@color@foot@right ([xshift=3mm,yshift=-1.65mm]\pingu@name-foot-right) to[bend left=3] ++(-5mm,0) -- ++(-.05mm,.6mm) to[out=97,in=76,looseness=1.125] cycle;
    \ifx\pingu@color@foot@right\@pingu@none\else
        \colorlet{@}{\pingu@color@foot@right!80!\pingu@color@body@main}
        \pingu@draw{@} ([xshift=3mm,yshift=-1.65mm]\pingu@name-foot-right) to[bend left=5] coordinate[pos=.29] (@) coordinate[pos=.69] (@b)  ++(-5mm,0) -- ++(-.05mm,.475mm) to[out=97,in=81,looseness=1.125] cycle;
        \pingu@draw{@} (@) to[bend left=4] ++(-.125mm,.75mm);
        \pingu@draw{@} (@b) to[bend left=9] ++(-.15mm,1.15mm);
    \fi
\endpingu@layer
}
% #endregion

% #region bill
% name core | main
\long\def\@pingu@bill@s#1#2{%
    \pgfqkeys{/pingu}{%
        bill #1/.style   = {/pingu/bill={#1}, /pingu/bill color={##1}},%
        bill #1/.default = pingu@yellow% TODO: defaults
    }%
    \pingu@bill@add{#1}{#2}%
}
\pgfqkeys{/pingu}{bill none/.style={/pingu/bill=none}}

\@pingu@bill@s{normal}{%
\pingu@block{\pingu@color@bill} (\pingu@name-bill)++(-.19cm,0)
    arc (180:360:.19cm and .225cm)
    coordinate[pos=.5] (\pingu@name-bill-bottom)
    to[bend right=.25cm] cycle;
}

\@pingu@bill@s{foreground}{%
\pingu@layer{foreground}[]
\pingu@block{\pingu@color@bill} (\pingu@name-bill)++(-.19cm,0)
    arc (180:360:.19cm and .225cm)
    coordinate[pos=.5] (\pingu@name-bill-bottom)
    to[bend right=.25cm] cycle;
\endpingu@layer
}

\@pingu@bill@s{flat}{%
\pingu@block{\pingu@color@bill} (\pingu@name-bill)++(-.19cm,0)
    arc (180:360:.19cm and .225cm)
    coordinate[pos=.5] (\pingu@name-bill-bottom)
    -- cycle;
}

% #endregion
% #endregion

% #region dots
\def\@pingu@draw@dots{%
\pingu@layer{foreground}[]
    % mark wing outer
    \path[draw,pink,thick] (\pingu@name-wing-left-start-low) --(\pingu@name-wing-left-start) -- (\pingu@name-wing-left) -- (\pingu@name-wing-left-low);
    \path[draw,pink,thick] (\pingu@name-wing-right-start-low) -- (\pingu@name-wing-right-start) -- (\pingu@name-wing-right) -- (\pingu@name-wing-right-low);
  \@for\@pingu@elem:={belly-center,head,head-top,foot-left,foot-right,eye-right,eye-left,bill,bill-bottom,wings-side-left,wings-side-right,wing-left-start,wing-left-tip,wing-right-start,wing-right-tip,head-right,head-left,head-center,head-back-con-left,head-back-con-right,bottom-center,waist-left,waist-right}\do{
    \path[fill=green] (\pingu@name-\@pingu@elem) circle[radius=1.125\p@];
  }
  \@for\@pingu@elem:={wing-left,wing-right,wing-left-low,wing-right-low,wing-left-up,wing-right-up,wing-left-start-low,wing-right-start-low,wing-left-start-up,wing-right-start-up}\do{
    \path[fill=yellow] (\pingu@name-\@pingu@elem) circle[radius=1.125\p@];
  }
  % mark wing items
  \csname @pingu@wingitem@\@pingu@select@leftwing@ @\endcsname \colorlet{@wmark}{magenta} \else \colorlet{@wmark}{teal} \fi
  \pingu@block[/pingu/@draw=@wmark,thick,rotate around={\csname @pingu@wingangle@items@\@pingu@select@leftwing@ @\endcsname:(\pingu@name-wing-left)}]{@wmark}
    (\pingu@name-wing-left)++(0,3mm) circle [radius=\pingu@one] -- ++(0,-6mm);
  \csname @pingu@wingitem@\@pingu@select@rightwing@ @\endcsname \colorlet{@wmark}{magenta} \else \colorlet{@wmark}{teal} \fi
  \pingu@block[/pingu/@draw=@wmark,thick,rotate around={-\csname @pingu@wingangle@items@\@pingu@select@rightwing@ @\endcsname:(\pingu@name-wing-right)}]{@wmark}
    (\pingu@name-wing-right)++(0,3mm) circle [radius=\pingu@one] -- ++(0,-6mm);
\endpingu@layer}
% endregion
% #region extras
%     #region extras below
\def\pingu@@xif@eb#1#2{\csname if@pingu@x@#1@\endcsname\csname pingu@draw@eb@#2\endcsname\fi}
\def\pingu@xif@eb#1#2{\ifcsname if@pingu@x@#1@\endcsname{\pingu@@xif@eb{#1}{#2}}\fi}
\def\pingu@draw@extras@below{%
    \pingu@xif@eb{devilwings}{devilwings}%
    \pingu@xif@eb{glow}{glow}%
    \pingu@xif@eb{tie}{tie}%
    \pingu@xif@eb{pants}{pants}%
    \pingu@xif@eb{medal}{medal}%
    \pingu@xif@eb{bowtie}{bowtie}%
    \pingu@xif@eb{cup}{cup}%
    \pingu@xif@eb{blush}{blush}%
    \pingu@xif@eb{eyepatchleft}{eyepatch@l}%
    \pingu@xif@eb{eyepatchright}{eyepatch@r}%
    \pingu@xif@eb{monocleleft}{monocle@l}%
    \pingu@xif@eb{monocleright}{monocle@r}%
}
%       #region cup
\pingu@create@extra{cup}{%
  % extra cup % TODO: as selection
  cup/.code       = {\pingu@set@extra{cup}{true}\pingu@color{cup}{#1}},
  cup/.default    = pingu@green,
  cup straw/.code = \pingu@color{cup@straw}{#1}%
}{cup straw=\pingu@color@cup}

\def\pingu@draw@eb@cup{%
    \pingu@block[rounded corners=.25mm]{\pingu@color@cup} (\pingu@name-belly-center)++(-.325cm,.275cm) to[bend right=2] ++(.5mm,-.675cm) to[bend right=8] ++(.55cm,\z@) to[bend right=2] ++(.5mm,.675cm);
    \path (\pingu@name-belly-center)++(0,.275cm) -- (\pingu@name-bill) coordinate[pos=.5,xshift=-2mm] (\pingu@name-cup-straw-outer-angle);
    \path (\pingu@name-belly-center)++(-.115cm,.275cm) coordinate (\pingu@name-straw-outer-start);
    \pingu@block[rounded corners=.15mm]{\pingu@color@cup@straw} (\pingu@name-straw-outer-start) -- (\pingu@name-cup-straw-outer-angle) -- (\pingu@name-bill) -- ++(.5mm,0) -- ([xshift=.5mm]\pingu@name-cup-straw-outer-angle) -- ([xshift=.5mm]\pingu@name-straw-outer-start) -- cycle;
    \pingu@block{\pingu@color@cup} (\pingu@name-belly-center)++(0,.275cm) ellipse [x radius=.325cm,y radius=.5mm];
}
%       #endregion

%       #region eye patch
%         #region eye patch left
\pingu@create@extra{eyepatchleft}{%
    eyepatch left/.forward to = /pingu/eye patch left,
    eye-patch left/.forward to = /pingu/eye patch left,
    eye patch left/.code      = \pingu@set@extra{eyepatchleft}{true}\pingu@color{eyepatchleft}{#1},
    eye patch left/.default   = \pingu@color@body@main,
}{}

\newlength\pingu@patchw \pingu@patchw=6.5pt
\def\pingu@draw@eb@eyepatch@l{%
    \pingu@draw[line width=1.25pt,line cap=round]{\pingu@color@eyepatchleft} (\pingu@name-head-right)++(-2.75mm,-2.5mm) to[bend right=10] coordinate[pos=.71] (\pingu@name-eye-left-patch) ([xshift=-.85mm,yshift=1.25mm]\pingu@name-wings-side-left);
    \pingu@block[rotate around={-9:(\pingu@name-eye-left-patch)}]{\pingu@color@eyepatchleft} (\pingu@name-eye-left-patch)++(0,.5pt) ellipse [x radius=\pingu@patchw, y radius=.65pt];
    \pingu@block[rotate around={-9:(\pingu@name-eye-left-patch)}]{\pingu@color@eyepatchleft} (\pingu@name-eye-left-patch) ++(-\pingu@patchw,.5pt) arc(180:360:\pingu@patchw{} and 8.9pt);
}
%         #endregion
%         #region eye patch right
\pingu@create@extra{eyepatchright}{%
    eyepatch right/.forward to = /pingu/eye patch right,
    eye-patch right/.forward to = /pingu/eye patch right,
    eye patch right/.code      = \pingu@set@extra{eyepatchright}{true}\pingu@color{eyepatchright}{#1},
    eye patch right/.default   = \pingu@color@body@main,
}{}

\def\pingu@draw@eb@eyepatch@r{%
    \pingu@draw[line width=1.25pt,line cap=round]{\pingu@color@eyepatchright} (\pingu@name-head-left)++(2.75mm,-2.5mm) to[bend left=10] coordinate[pos=.71] (\pingu@name-eye-right-patch) ([xshift=.85mm,yshift=1.25mm]\pingu@name-wings-side-right);
    \pingu@block[rotate around={9:(\pingu@name-eye-right-patch)}]{\pingu@color@eyepatchright} (\pingu@name-eye-right-patch)++(0,.5pt) ellipse [x radius=\pingu@patchw, y radius=.65pt];
    \pingu@block[rotate around={9:(\pingu@name-eye-right-patch)}]{\pingu@color@eyepatchright} (\pingu@name-eye-right-patch) ++(-\pingu@patchw,.5pt) arc(180:360:\pingu@patchw{} and 8.9pt);
}
%         #endregion
%       #endregion

% #region glow
\pingu@create@extra{glow}{%
    glow/.code       = \pingu@set@extra{glow}{true}\pingu@color{glow}{#1},
    glow/.default    = pingu@white,
    glow thick/.style = {/pingu/glow={#1}, /pingu/glow width function={3.5mm-1.25*\i mm}},
    glow steps/.code = \def\pingu@x@extra@glow@steps{#1},
    glow function/.code = \def\pingu@x@extra@glow@func{#1},
    glow width function/.code = \def\pingu@x@extra@glow@width@func{#1},
    glow solid/.style = {/pingu/glow={#1},/pingu/glow function={1},/pingu/glow steps={1.2,1.3}}
}{glow steps={1,1.1,1.2,1.3,1.4,1.5},glow function={.1/\i},glow width function={2.85mm-1.65*\i mm}}

\def\pingu@draw@eb@glow{%
    \pingu@layer{background}[]
    \@for\i:={\pingu@x@extra@glow@steps}\do{
        \scope[/pingu/@block/.append style={draw=\pingu@color@glow,line width=\pingu@x@extra@glow@width@func},/pingu/@draw/.append style={draw=\pingu@color@glow,line width=\pingu@x@extra@glow@width@func},opacity=\pingu@x@extra@glow@func,transparency group]
        \pingu@draw{\pingu@color@glow} \pingu@path@lowerpingu;
        % todo: disable re set of coordinates
        % only draw, if not ofset
        \csname @pingu@wingitem@\@pingu@select@leftwing@ @\endcsname\@pingu@drawer@leftwing@\fi
        \csname @pingu@wingitem@\@pingu@select@rightwing@ @\endcsname\@pingu@drawer@rightwing@\fi
        \endscope
    }
    \endpingu@layer
}
% #endregion
%     #endregion

%     #region extras above
% NOTE: No auto append to allow easy order change
\def\pingu@@xif@ea#1#2{\csname if@pingu@x@#1@\endcsname\csname pingu@draw@ea@#2\endcsname\fi}
\def\pingu@xif@ea#1#2{\ifcsname if@pingu@x@#1@\endcsname{\pingu@@xif@ea{#1}{#2}}\fi}
\def\pingu@draw@extras@above{%
    \pingu@xif@ea{cap}{cap}%
    \pingu@xif@ea{eyeframe}{eyeframe}%
    \pingu@xif@ea{mask}{mask}%
    \pingu@xif@ea{glasses}{glasses}%
    \pingu@xif@ea{glassesround}{glassesround}%
    \pingu@xif@ea{devilhorns}{devilhorns}%
    \pingu@xif@ea{headband}{headband}%
    \pingu@xif@ea{strawhat}{strawhat}%
    \pingu@xif@ea{hat}{hat}%
    \pingu@xif@ea{constructionhelmet}{constructionhelmet}%
    \pingu@xif@ea{conicalhat}{conicalhat}%
    \pingu@xif@ea{crown}{crown}%
    \pingu@xif@ea{cakehat}{cakehat}%
    \pingu@xif@ea{pumpkinhat}{pumpkinhat}%
    \pingu@xif@ea{princesscrown}{princesscrown}%
    \pingu@xif@ea{rook}{rook}%
    \pingu@xif@ea{halo}{halo}%
    \pingu@xif@ea{vrheadset}{vrheadset}%
    \pingu@xif@ea{headphone}{headphone}%
    \pingu@xif@ea{sheriffstar}{sheriffstar}%
    \pingu@xif@ea{santahat}{santahat}%
    \pingu@xif@ea{santabeard}{santabeard}%
    \pingu@xif@ea{banner}{banner}%
}
% #region halo
\newif\if@pingu@x@halo@glow
\newif\if@pingu@x@halo@above
\pingu@create@extra{halo}{%
    halo/.code    	 = \pingu@set@extra{halo}{true}\pingu@color{halo}{#1},
    halo/.default    = pingu@lightblue,
    halo raise/.code = \def\pingu@x@halo@raise{#1},
    halo above/.is if = @pingu@x@halo@above,
    halo glow/.is if = @pingu@x@halo@glow% only active if glows loaded
}{halo glow=\ifpengu@setup@glows@ true\else false\fi,halo raise=0mm,halo above=false}

\def\pingu@draw@ea@halo{%
\if@pingu@x@halo@above\pingu@layer{foreground}[]\fi
\pingu@block[even odd rule]{\pingu@color@halo} ([yshift=\pingu@x@halo@raise]\pingu@name-head-top) ellipse [x radius=\pingu@w@half-\pingu@one,y radius=2.5mm] ellipse [x radius=\pingu@w@half-1.95mm,y radius=1.55mm];
\if@pingu@x@halo@glow
\pingu@block[even odd rule,/pingu/@glow]{\pingu@color@halo} ([yshift=\pingu@x@halo@raise]\pingu@name-head-top) ellipse [x radius=(\pingu@w@half-1.95mm)*1.7,y radius=1.55mm*2.35] ellipse [x radius=\pingu@w@half-1.95mm,y radius=1.55mm];
\fi
\if@pingu@x@halo@above\endpingu@layer{foreground}\fi
}
% #endregion

% #region eye frame
\pingu@create@extra{eyeframe}{%
    % extra halo
    eyeframe/.forward to  = /pingu/eye frame,
    eye-frame/.forward to = /pingu/eye frame,
    eye frame/.code       = \pingu@set@extra{eyeframe}{true}\pingu@color{eyeframe}{#1},
    eye frame/.default    = pingu@black,
}{}

\def\pingu@draw@ea@eyeframe{%
    \pingu@draw{\pingu@color@eyeframe} [rounded corners=.25mm](\pingu@name-eye-left)++(-2mm,1.5mm) to[bend left=8] ++(4.2mm,0) to[out=-80,in=70] ++(-.2mm,-2.75mm) to[bend left=32.5] ++(-3.65mm,0mm) to[out=135,in=-90] ++(-.8mm,2.7mm) -- cycle;
    \pingu@draw{\pingu@color@eyeframe} [rounded corners=.25mm](\pingu@name-eye-right)++(2mm,1.5mm) to[bend right=8] ++(-4.2mm,0) to[out=-100,in=110] ++(.2mm,-2.75mm) to[bend right=32.5] ++(3.65mm,0mm) to[out=45,in=-90] ++(.8mm,2.7mm) -- cycle;
}
% #endregion

% #region sheriff star
\pingu@create@extra{sheriffstar}{%
    sheriff star/.code             = \pingu@set@extra{sheriffstar}{true}\pingu@color{sheriffstar}{#1},
    sheriff star/.default          = pingu@yellow,
    sheriff star content/.code     = \def\pingu@x@sheriff@star@content{#1},
    sheriff star lines/.code       = \pingu@color{sheriffstar@lines}{#1},
}{sheriff star content={\resizebox{2.25mm}!{\textsf{\bfseries Sheriff}}},sheriff star lines=pingu@black!92!\pingu@color@sheriffstar}

\def\pingu@draw@ea@sheriffstar{%
\pingu@layer{middle}[]
\path (\pingu@name-belly-center) -- (\pingu@name-head-back-con-left) node[pos=.6, star, star points=7, fill=\pingu@color@sheriffstar,minimum size=1.75mm,scale=.9,rotate=-5] (@) {};
\foreach \i in {1,...,7} {
    \pingu@block{\pingu@color@sheriffstar!98!pingu@black} (@.outer point \i) circle [radius=.2mm];
}

\node[,outer sep=0pt,inner xsep=0pt,inner ysep=.25mm] (@s) at (@) {\ifx\pingu@color@sheriffstar@lines\@pingu@none\else\color{\pingu@color@sheriffstar@lines}\fi\pingu@x@sheriff@star@content};
\pingu@draw[line width=.002mm]{\pingu@color@sheriffstar@lines} (@s.north east) -- (@s.north west);
\pingu@draw[line width=.002mm]{\pingu@color@sheriffstar@lines} (@s.south east) -- (@s.south west);
\endpingu@layer}
% #endregion

%     #endregion
% #endregion

% #region wingitems
%     #region wingitems-setup
\def\pingu@may@draw@wing#1#2{\csname if@pingu@x@#1#2@\endcsname \csname pingu@draw@wi@#1\endcsname{#2}\fi}
\edef\pingu@str@wing@left{left}
\let\@pingu@wingitems@\@empty
\newif\if@pingu@wing@item@side@left@
\def\pingu@setup@wing#1#2{%
    \edef\@tmpa{#2}% minus on left
    \ifx\pingu@str@wing@left\@tmpa
        \expandafter\def\expandafter\@angle{\csname @pingu@wingangle@items@\csname @pingu@select@#2wing@\endcsname @\endcsname+\pingu@wing@left@item@angle@user}%
        \def\@sidesign{1}%
        \if@pingu@wi@flip@left \@pingu@wing@item@side@left@false \else \@pingu@wing@item@side@left@true\fi
    \else
        \expandafter\def\expandafter\@angle{-(\csname @pingu@wingangle@items@\csname @pingu@select@#2wing@\endcsname @\endcsname+\pingu@wing@right@item@angle@user)}%
        \def\@sidesign{-1}%
        \if@pingu@wi@flip@right \@pingu@wing@item@side@left@true \else \@pingu@wing@item@side@left@false\fi
    \fi
    \expandafter\def\expandafter\@col{\csname pingu@color@#1#2\endcsname}%
}

\def\pingu@draw@wing@items{%
\pingu@layer{middle}[]\@pingu@draw@wing@items@left\endpingu@layer
\pingu@layer{middle}[]\@pingu@draw@wing@items@right\endpingu@layer
}

\let\@pingu@draw@wing@items@left\@empty
\let\@pingu@draw@wing@items@right\@empty

\def\pingu@create@wing@extra#1#2#3{%
\pingu@csappto{@pingu@wingitems@}{#1}%
\expandafter\def\expandafter\@pingu@draw@wing@items@left\expandafter{\@pingu@draw@wing@items@left\pingu@may@draw@wing{#1}{left}}%
\expandafter\def\expandafter\@pingu@draw@wing@items@right\expandafter{\@pingu@draw@wing@items@right\pingu@may@draw@wing{#1}{right}}%
\def\@lr{left}%
\protected@edef\@tmp{\expandafter\expandafter\expandafter\expandafter\expandafter\unexpanded{{#1left}{#2}{#3}}}%
\expandafter\pingu@create@extra\@tmp
\def\@lr{right}%
\protected@edef\@tmp{\expandafter\expandafter\expandafter\expandafter\expandafter\unexpanded{{#1right}{#2}{#3}}}%
\expandafter\pingu@create@extra\@tmp}
%     #endregion

%     #region cane
\pingu@create@wing@extra{cane}{%
  cane \@lr/.code             = {\pingu@set@extra{cane\@lr}{true}\pingu@color{cane\@lr}{##1}},
  cane \@lr/.default          = pingu@bronze,
  cane \@lr\space raise/.code = {\@namedef{pinug@x@cane@raise@\@lr}{##1}},
  cane \@lr\space length/.code = {\@namedef{pinug@x@cane@length@\@lr}{##1}},
}{cane \@lr\space raise=0mm,cane \@lr\space length=15mm}

% #1 wing
\def\pingu@draw@wi@cane#1{%
    \pingu@setup@wing{cane}{#1}%
    \if@pingu@wing@item@side@left@
        \pingu@block[thick,rotate around={\@angle+5:(\pingu@name-wing-#1)}]{\@col}(\pingu@name-wing-#1)++(0,-7mm+\pinug@x@cane@raise@left) -- ++(0,\csname pinug@x@cane@length@#1\endcsname) arc(180:0:2.25mm and 2.2mm) arc(360:180:.3mm and .275mm) arc(0:180:1.65mm and 1.65mm) -- ++(0,-\csname pinug@x@cane@length@#1\endcsname) arc(360:180:.3mm and .275mm) -- cycle;
    \else
        \pingu@block[thick,rotate around={\@angle-5:(\pingu@name-wing-#1)}]{\@col}(\pingu@name-wing-#1)++(0,-7mm+\pinug@x@cane@raise@right) -- ++(0,\csname pinug@x@cane@length@#1\endcsname) arc(0:180:2.25mm and 2.2mm) arc(180:360:.3mm and .275mm) arc(180:0:1.65mm and 1.65mm) -- ++(0,-\csname pinug@x@cane@length@#1\endcsname) arc(180:360:.3mm and .275mm) -- cycle;
    \fi
}
%     #endregion

%     #region staff
\pingu@create@wing@extra{staff}{%
    staff \@lr/.code         = {\pingu@set@extra{staff\@lr}{true}\pingu@color{staff\@lr}{##1}},
    staff \@lr/.default      = pingu@bronze,
    staff \@lr\space length/.code =\expandafter\def\csname pingu@staff@\@lr @length\endcsname{##1},
}{staff \@lr\space length=28mm}
\def\pingu@draw@wi@staff#1{%
    \pingu@setup@wing{staff}{#1}%
\scope[rotate around={\@angle:(\pingu@name-wing-#1)}]
    \pingu@block{\csname pingu@color@staff#1\endcsname}(\pingu@name-wing-#1)++(\@sidesign*-.2mm,-11mm) -- ++(0,\csname pingu@staff@#1@length\endcsname) arc(180:0:\@sidesign*.4mm and .3mm) coordinate[pos=.5] (\pingu@name-staff-#1-top) -- ++(0,-\csname pingu@staff@#1@length\endcsname) arc(360:180:\@sidesign*.4mm and .3mm) -- cycle;
\endscope
}
%     #endregion
% #endregion

% #region clothes
\def\pingu@@xif@cloth#1#2{\csname if@pingu@x@#1@\endcsname\csname pingu@draw@cloth@#2\endcsname\fi}
\def\pingu@xif@cloth#1#2{\ifcsname if@pingu@x@#1@\endcsname{\pingu@@xif@cloth{#1}{#2}}\fi}
\def\pingu@draw@clothing@behind{%
    \pingu@xif@cloth{secondshirt}{secondshirt@behind}%
    \pingu@xif@cloth{shirt}{shirt@behind}%
    \pingu@xif@cloth{cloak}{cloak@behind}%
}

\def\pingu@draw@clothing@middle{%
    \pingu@xif@cloth{secondshirt}{secondshirt@middle}%
    \pingu@xif@cloth{shirt}{shirt@middle}%
    \pingu@xif@cloth{cloak}{cloak@middle}%
}

\def\pingu@draw@clothing@main{%
    \pingu@xif@cloth{secondshirt}{secondshirt}%
    \pingu@xif@cloth{shirt}{shirt}%
    \pingu@xif@cloth{cloak}{cloak}%
}
% #endregion

\def\pingu@@dummy@lib#1#2{%
    \pgfqkeys{/pingu}{#1/.code={\PackageError{\tikzpingus@filename}{To use '#1' you need to load the '#2' library via '\string\pinguloadlibrary{#2}'}}}%
    \expandafter\def\csname pingu@@lib@#1@\endcsname{#2}%
}
\def\pingu@@dummy@selector#1#2#3{%
    \expandafter\csname pingu@#3@add\endcsname{#1}{\PackageError{\tikzpingus@filename}{To use '#1' with '#3' you need to load the '#2' library via '\string\pinguloadlibrary{#2}'}}%
    \expandafter\def\csname pingu@@lib@#1@#3@\endcsname{#2}%
}
\def\pingu@dummy@lib#1#2{\edef\tmp@list{#2}\@for\@current:=\tmp@list\do{\expandafter\pingu@@dummy@lib\expandafter{\@current}{#1}}\xappto\pingu@defaultlibs{,{#1}/{#2}}\xappto\pingu@@defaultlibs{,#1}}%
% library | selector | keys
\def\pingu@dummy@selector#1#2#3{\edef\tmp@list{#3}\@for\@current:=\tmp@list\do{\expandafter\pingu@@dummy@selector\expandafter{\@current}{#1}{#2}}}
\def\pingu@defaultlibs{}\def\pingu@@defaultlibs{}
\def\pingu@load@library#1{%
% store common catcodes
\expandafter\edef\csname pingu@lib@#1@atcode\endcsname{\the\catcode`\@}%
\expandafter\edef\csname pingu@lib@#1@barcode\endcsname{\the\catcode`\|}%
\expandafter\edef\csname pingu@lib@#1@dollarcode\endcsname{\the\catcode`\$}%
\catcode`\@=11 \catcode`\|=12 \catcode`\$=3\relax
\def\pingu@tmp{tikzpingus-#1.lib.tex}\relax
\InputIfFileExists{\pingu@tmp}{}{\PackageError{\tikzpingus@filename}{There is no '#1' library (searched: '\pingu@tmp')}}
% restore catcodes
\catcode`\@=\csname pingu@lib@#1@atcode\endcsname
\catcode`\|=\csname pingu@lib@#1@barcode\endcsname
\catcode`\$=\csname pingu@lib@#1@dollarcode\endcsname
}
\def\pingu@loadlibrary#1{%
\ifcsname pingu@lib@#1@loaded\endcsname\else% do not load again
    \expandafter\let\csname pingu@lib@#1@loaded\endcsname=\@empty
    \pingu@load@library{#1}\relax
\fi
}
\def\pinguloadlibrary#1{\edef\tmp@list{#1}\@for\tmp@elem:=\tmp@list\do{\ifx\tmp@elem\@empty\else\pingu@loadlibrary{\tmp@elem}\fi}}
\let\pinguloadlibraries\pinguloadlibrary

\pingu@dummy@lib{shirts}{shirt,second shirt}
\pingu@dummy@lib{glasses}{glasses,glasses round,monocle left,monocle right}
\pingu@dummy@lib{medieval}{rook,crown,princess crown}
\pingu@dummy@lib{cloak}{cloak,cape}
\pingu@dummy@lib{christmas}{santa hat,santa beard}
\pingu@dummy@lib{science-fiction}{lightsaber left,lightsaber right}
\pingu@dummy@lib{fun}{cake-hat,pumpkin-hat,lollipop left,lollipop right}
\pingu@dummy@lib{technology}{vr-headset,headphone,vr-controller left,vr-controller right,laptop left,laptop right}
\pingu@dummy@lib{flags}{flag left,flag right}
\pingu@dummy@lib{hats}{strawhat,hat,cap,construction helmet,conical hat}
\pingu@dummy@lib{sport}{head band,medal}
\pingu@dummy@lib{formal}{tie,bow tie,pants}
\pingu@dummy@lib{signs}{sign post left,sign post right}
\pingu@dummy@lib{devil}{devil horns,devil wings,devil fork left,devil fork right,eyes devil,left eye devil,right eye devil}
\pingu@dummy@selector{devil}{lefteye}{devil}
\pingu@dummy@selector{devil}{righteye}{devil}
\pingu@dummy@lib{safe}{mask}
\pingu@dummy@lib{magic}{handcast left,handcast right}
\pingu@dummy@lib{movement}{}% register the lib
\pingu@dummy@selector{movement}{bodytype}{tilt-right,tilt-left}
\pingu@dummy@lib{emotions}{eyes sad,left eye sad,right eye sad,eyes angry,left eye angry,right eye angry,eyes hearts,left eye heart,right eye hearts,bill angry,blush}
\pingu@dummy@selector{emotions}{lefteye}{sad,angry,hearts}
\pingu@dummy@selector{emotions}{righteye}{sad,angry,hearts}

\pingu@dummy@lib{horse}{horse left,horse right}

\ifpengu@setup@bare@\else
\pinguloadlibraries{\pingu@@defaultlibs}
\fi
\endinput