Skip to content

Commit 2f5cafa

Browse files
committed
add sample Pinwheel templates and a readme
1 parent a6cfb2e commit 2f5cafa

23 files changed

+1570
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import androidx.compose.ui.graphics.Color
2+
3+
{% for item in items %}
4+
{% if item.colorItem %}
5+
val {{ item.name }} = Color({% colorAsHexARGB item.colorItem.color.light %})
6+
{% if item.colorItem.color.dark %}
7+
val {{ item.name }}Dark = Color({% colorAsHexARGB item.colorItem.color.dark %})
8+
{% endif %}
9+
{% if item.colorItem.color.highContrast %}
10+
val {{ item.name }}HighContrast = Color({% colorAsHexARGB item.colorItem.color.highContrast %})
11+
{% endif %}
12+
{% if item.colorItem.color.darkHighContrast %}
13+
val {{ item.name }}DarkHighContrast = Color({% colorAsHexARGB item.colorItem.color.darkHighContrast %})
14+
{% endif %}
15+
16+
{% elif item.colorSet %}
17+
{% for color in item.colorSet.colors %}
18+
val {{ item.name }}{{ color.name }} = Color({% colorAsHexARGB color.light %})
19+
{% if color.dark %}
20+
val {{ item.name }}{{ color.name }}Dark = Color({% colorAsHexARGB color.dark %})
21+
{% endif %}
22+
{% if color.highContrast %}
23+
val {{ item.name }}{{ color.name }}HighContrast = Color({% colorAsHexARGB color.highContrast %})
24+
{% endif %}
25+
{% if color.darkHighContrast %}
26+
val {{ item.name }}{{ color.name }}DarkHighContrast = Color({% colorAsHexARGB color.darkHighContrast %})
27+
{% endif %}
28+
{% endfor %}
29+
30+
{% elif item.number %}
31+
val {{ item.name }} = {{ item.number.value.light }}
32+
{% if item.number.value.dark %}
33+
val {{ item.name }}Dark = {{ item.number.value.dark }}
34+
{% endif %}
35+
{% if item.number.value.highContrast %}
36+
val {{ item.name }}HighContrast = {{ item.number.value.highContrast }}
37+
{% endif %}
38+
{% if item.number.value.darkHighContrast %}
39+
val {{ item.name }}DarkHighContrast = {{ item.number.value.darkHighContrast }}
40+
{% endif %}
41+
42+
{% elif item.boolean %}
43+
val {{ item.name }} = {{ item.boolean.value.light }}
44+
{% if item.boolean.value.dark %}
45+
val {{ item.name }}Dark = {{ item.boolean.value.dark }}
46+
{% endif %}
47+
{% if item.boolean.value.highContrast %}
48+
val {{ item.name }}HighContrast = {{ item.boolean.value.highContrast }}
49+
{% endif %}
50+
{% if item.boolean.value.darkHighContrast %}
51+
val {{ item.name }}DarkHighContrast = {{ item.boolean.value.darkHighContrast }}
52+
{% endif %}
53+
54+
{% elif item.string %}
55+
val {{ item.name }} = "{{ item.string.value.light }}"
56+
{% if item.string.value.dark %}
57+
val {{ item.name }}Dark = "{{ item.string.value.dark }}"
58+
{% endif %}
59+
{% if item.string.value.highContrast %}
60+
val {{ item.name }}HighContrast = "{{ item.string.value.highContrast }}"
61+
{% endif %}
62+
{% if item.string.value.darkHighContrast %}
63+
val {{ item.name }}DarkHighContrast = "{{ item.string.value.darkHighContrast }}"
64+
{% endif %}
65+
66+
{% endif %}
67+
{% endfor %}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{% for item in items %}
2+
{% if item.colorItem %}
3+
constant constexpr auto {{ item.name }} = float4({{ item.colorItem.color.light.red }}, {{ item.colorItem.color.light.green }}, {{ item.colorItem.color.light.blue }}, {{ item.colorItem.color.light.alpha}});
4+
{% if item.colorItem.color.dark %}
5+
constant constexpr auto {{ item.name }}Dark = float4({{ item.colorItem.color.dark.red }}, {{ item.colorItem.color.dark.green }}, {{ item.colorItem.color.dark.blue }}, {{ item.colorItem.color.dark.alpha }});
6+
{% endif %}
7+
{% if item.colorItem.color.highContrast %}
8+
constant constexpr auto {{ item.name }}HighContrast = float4({{ item.colorItem.color.highContrast.red }}, {{ item.colorItem.color.highContrast.green }}, {{ item.colorItem.color.highContrast.blue }}, {{ item.colorItem.color.highContrast.alpha }});
9+
{% endif %}
10+
{% if item.colorItem.color.darkHighContrast %}
11+
constant constexpr auto {{ item.name }}DarkHighContrast = float4({{item.colorItem.color.darkHighContrast.red }}, {{ item.colorItem.color.darkHighContrast.green }}, {{item.colorItem.color.darkHighContrast.blue }}, {{ item.colorItem.color.darkHighContrast.alpha }});
12+
{% endif %}
13+
{% elif item.colorSet %}
14+
{% for color in item.colorSet.colors %}
15+
constant constexpr auto {{ item.name }}{{ color.name }} = float4({{ color.light.red }}, {{ color.light.green }}, {{ color.light.blue}}, {{ color.light.alpha}});
16+
{% if color.dark %}
17+
constant constexpr auto {{ item.name }}{{ color.name }}Dark = float4({{ color.dark.red }}, {{ color.dark.green }}, {{ color.dark.blue}}, {{ color.dark.alpha }});
18+
{% endif %}
19+
{% if color.highContrast %}
20+
constant constexpr auto {{ item.name }}{{ color.name }}HighContrast = float4({{ color.highContrast.red }}, {{ color.highContrast.green }}, {{ color.highContrast.blue }}, {{ color.highContrast.alpha}});
21+
{% endif %}
22+
{% if color.darkHighContrast %}
23+
constant constexpr auto {{ item.name }}{{ color.name }}DarkHighContrast = float4({{ color.darkHighContrast.red }}, {{ color.darkHighContrast.green}}, {{ color.darkHighContrast.blue }}, {{ color.darkHighContrast.alpha}});
24+
{% endif %}
25+
{% endfor %}
26+
{% elif item.number %}
27+
constant constexpr auto {{ item.name }} = {{ item.number.value.light }};
28+
{% if item.number.value.dark %}
29+
constant constexpr auto {{ item.name }}Dark = {{ item.number.value.dark }};
30+
{% endif %}
31+
{% if item.number.value.highContrast %}
32+
constant constexpr auto {{ item.name }}HighContrast = {{ item.number.value.highContrast }};
33+
{% endif %}
34+
{% if item.number.value.darkHighContrast %}
35+
constant constexpr auto {{ item.name }}DarkHighContrast = {{ item.number.value.darkHighContrast }};
36+
{% endif %}
37+
{% elif item.boolean %}
38+
constant constexpr auto {{ item.name }} = {{ item.boolean.value.light }};
39+
{% if item.boolean.value.dark %}
40+
constant constexpr auto {{ item.name }}Dark = {{ item.boolean.value.dark }};
41+
{% endif %}
42+
{% if item.boolean.value.highContrast %}
43+
constant constexpr auto {{ item.name }}HighContrast = {{ item.boolean.value.highContrast }};
44+
{% endif %}
45+
{% if item.boolean.value.darkHighContrast %}
46+
constant constexpr auto {{ item.name }}DarkHighContrast = {{ item.boolean.value.darkHighContrast }};
47+
{% endif %}
48+
{% elif item.string %}
49+
const char* {{ item.name }} = "{{ item.string.value.light }}";
50+
{% if item.string.value.dark %}
51+
const char* {{ item.name }}Dark = "{{ item.string.value.dark }}";
52+
{% endif %}
53+
{% if item.string.value.highContrast %}
54+
const char* {{ item.name }}HighContrast = "{{ item.string.value.highContrast }}";
55+
{% endif %}
56+
{% if item.string.value.darkHighContrast %}
57+
const char* {{ item.name }}DarkHighContrast = "{{ item.string.value.darkHighContrast }}";
58+
{% endif %}
59+
{% endif %}
60+
{% endfor %}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{% for item in items %}
2+
{% if item.colorItem %}
3+
const vec4 {{ item.name }} = float4({{ item.colorItem.color.light.red }}, {{ item.colorItem.color.light.green }}, {{ item.colorItem.color.light.blue }}, {{ item.colorItem.color.light.alpha}});
4+
{% if item.colorItem.color.dark %}
5+
const vec4 {{ item.name }}Dark = float4({{ item.colorItem.color.dark.red }}, {{ item.colorItem.color.dark.green }}, {{ item.colorItem.color.dark.blue }}, {{ item.colorItem.color.dark.alpha }});
6+
{% endif %}
7+
{% if item.colorItem.color.highContrast %}
8+
const vec4 {{ item.name }}HighContrast = float4({{ item.colorItem.color.highContrast.red }}, {{ item.colorItem.color.highContrast.green }}, {{ item.colorItem.color.highContrast.blue }}, {{ item.colorItem.color.highContrast.alpha }});
9+
{% endif %}
10+
{% if item.colorItem.color.darkHighContrast %}
11+
const vec4 {{ item.name }}DarkHighContrast = float4({{item.colorItem.color.darkHighContrast.red }}, {{ item.colorItem.color.darkHighContrast.green }}, {{item.colorItem.color.darkHighContrast.blue }}, {{ item.colorItem.color.darkHighContrast.alpha }});
12+
{% endif %}
13+
{% elif item.colorSet %}
14+
{% for color in item.colorSet.colors %}
15+
const vec4 {{ item.name }}{{ color.name }} = float4({{ color.light.red }}, {{ color.light.green }}, {{ color.light.blue}}, {{ color.light.alpha}});
16+
{% if color.dark %}
17+
const vec4 {{ item.name }}{{ color.name }}Dark = float4({{ color.dark.red }}, {{ color.dark.green }}, {{ color.dark.blue}}, {{ color.dark.alpha }});
18+
{% endif %}
19+
{% if color.highContrast %}
20+
const vec4 {{ item.name }}{{ color.name }}HighContrast = float4({{ color.highContrast.red }}, {{ color.highContrast.green }}, {{ color.highContrast.blue }}, {{ color.highContrast.alpha}});
21+
{% endif %}
22+
{% if color.darkHighContrast %}
23+
const vec4 {{ item.name }}{{ color.name }}DarkHighContrast = float4({{ color.darkHighContrast.red }}, {{ color.darkHighContrast.green}}, {{ color.darkHighContrast.blue }}, {{ color.darkHighContrast.alpha}});
24+
{% endif %}
25+
{% endfor %}
26+
{% elif item.number %}
27+
const float {{ item.name }} = {{ item.number.value.light }};
28+
{% if item.number.value.dark %}
29+
const float {{ item.name }}Dark = {{ item.number.value.dark }};
30+
{% endif %}
31+
{% if item.number.value.highContrast %}
32+
const float {{ item.name }}HighContrast = {{ item.number.value.highContrast }};
33+
{% endif %}
34+
{% if item.number.value.darkHighContrast %}
35+
const float {{ item.name }}DarkHighContrast = {{ item.number.value.darkHighContrast }};
36+
{% endif %}
37+
{% elif item.boolean %}
38+
const GLboolean {{ item.name }} = {{ item.boolean.value.light }};
39+
{% if item.boolean.value.dark %}
40+
const GLboolean {{ item.name }}Dark = {{ item.boolean.value.dark }};
41+
{% endif %}
42+
{% if item.boolean.value.highContrast %}
43+
const GLboolean {{ item.name }}HighContrast = {{ item.boolean.value.highContrast }};
44+
{% endif %}
45+
{% if item.boolean.value.darkHighContrast %}
46+
const GLboolean {{ item.name }}DarkHighContrast = {{ item.boolean.value.darkHighContrast }};
47+
{% endif %}
48+
{% elif item.string %}
49+
const char* {{ item.name }} = "{{ item.string.value.light }}";
50+
{% if item.string.value.dark %}
51+
const char* {{ item.name }}Dark = "{{ item.string.value.dark }}";
52+
{% endif %}
53+
{% if item.string.value.highContrast %}
54+
const char* {{ item.name }}HighContrast = "{{ item.string.value.highContrast }}";
55+
{% endif %}
56+
{% if item.string.value.darkHighContrast %}
57+
const char* {{ item.name }}DarkHighContrast = "{{ item.string.value.darkHighContrast }}";
58+
{% endif %}
59+
{% endif %}
60+
{% endfor %}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import AppKit
2+
import Foundation
3+
4+
enum {{ exportFileName }} {
5+
{% for item in items %}
6+
{% if item.colorItem %}
7+
let {{ item.name }} = {%+ colorAsSwiftAppKitColor item.colorItem.color.light +%}
8+
{% if item.colorItem.color.dark %}
9+
let {{ item.name }}Dark = {%+ colorAsSwiftAppKitColor item.colorItem.color.dark +%}
10+
{% endif %}
11+
{% if item.colorItem.color.highContrast %}
12+
let {{ item.name }}HighContrast = {%+ colorAsSwiftAppKitColor item.colorItem.color.highContrast +%}
13+
{% endif %}
14+
{% if item.colorItem.color.darkHighContrast %}
15+
let {{ item.name }}DarkHighContrast = {%+ colorAsSwiftAppKitColor item.colorItem.color.darkHighContrast +%}
16+
{% endif %}
17+
18+
{% elif item.colorSet %}
19+
enum {{item.name}} {
20+
{% for color in item.colorSet.colors %}
21+
let {{ color.name }} = {%+ colorAsSwiftAppKitColor color.light +%}
22+
{% if color.dark %}
23+
let {{ color.name }} = {%+ colorAsSwiftAppKitColor color.dark +%}
24+
{% endif %}
25+
{% if color.highContrast %}
26+
let {{ color.name }} = {%+ colorAsSwiftAppKitColor color.highContrast +%}
27+
{% endif %}
28+
{% if color.darkHighContrast %}
29+
let {{ color.name }} = {%+ colorAsSwiftAppKitColor color.darkHighContrast +%}
30+
{% endif %}
31+
{% endfor %}
32+
}
33+
34+
{% elif item.number %}
35+
let {{ item.name }} = {{ item.number.value.light }}
36+
{% if item.number.value.dark %}
37+
let {{ item.name }}Dark = {{ item.number.value.dark }}
38+
{% endif %}
39+
{% if item.number.value.highContrast %}
40+
let {{ item.name }}HighContrast = {{ item.number.value.highContrast }}
41+
{% endif %}
42+
{% if item.number.value.darkHighContrast %}
43+
let {{ item.name }}DarkHighContrast = {{ item.number.value.darkHighContrast }}
44+
{% endif %}
45+
46+
{% elif item.boolean %}
47+
let {{ item.name }} = {{ item.boolean.value.light }}
48+
{% if item.boolean.value.dark %}
49+
let {{ item.name }}Dark = {{ item.boolean.value.dark }}
50+
{% endif %}
51+
{% if item.boolean.value.highContrast %}
52+
let {{ item.name }}HighContrast = {{ item.boolean.value.highContrast }}
53+
{% endif %}
54+
{% if item.boolean.value.darkHighContrast %}
55+
let {{ item.name }}DarkHighContrast = {{ item.boolean.value.darkHighContrast }}
56+
{% endif %}
57+
58+
{% elif item.string %}
59+
let {{ item.name }} = "{{ item.string.value.light }}"
60+
{% if item.string.value.dark %}
61+
let {{ item.name }}Dark = "{{ item.string.value.dark }}"
62+
{% endif %}
63+
{% if item.string.value.highContrast %}
64+
let {{ item.name }}HighContrast = "{{ item.string.value.highContrast }}"
65+
{% endif %}
66+
{% if item.string.value.darkHighContrast %}
67+
let {{ item.name }}DarkHighContrast = "{{ item.string.value.darkHighContrast }}"
68+
{% endif %}
69+
70+
{% endif %}
71+
{% endfor %}
72+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import Foundation
2+
import UIKit
3+
4+
enum {{ exportFileName }} {
5+
{% for item in items %}
6+
{% if item.colorItem %}
7+
let {{ item.name }} = {%+ colorAsSwiftUIColor item.colorItem.color.light +%}
8+
{% if item.colorItem.color.dark %}
9+
let {{ item.name }}Dark = {%+ colorAsSwiftUIColor item.colorItem.color.dark +%}
10+
{% endif %}
11+
{% if item.colorItem.color.highContrast %}
12+
let {{ item.name }}HighContrast = {%+ colorAsSwiftUIColor item.colorItem.color.highContrast +%}
13+
{% endif %}
14+
{% if item.colorItem.color.darkHighContrast %}
15+
let {{ item.name }}DarkHighContrast = {%+ colorAsSwiftUIColor item.colorItem.color.darkHighContrast +%}
16+
{% endif %}
17+
18+
{% elif item.colorSet %}
19+
enum {{item.name}} {
20+
{% for color in item.colorSet.colors %}
21+
let {{ color.name }} = {%+ colorAsSwiftUIColor color.light +%}
22+
{% if color.dark %}
23+
let {{ color.name }} = {%+ colorAsSwiftUIColor color.dark +%}
24+
{% endif %}
25+
{% if color.highContrast %}
26+
let {{ color.name }} = {%+ colorAsSwiftUIColor color.highContrast +%}
27+
{% endif %}
28+
{% if color.darkHighContrast %}
29+
let {{ color.name }} = {%+ colorAsSwiftUIColor color.darkHighContrast +%}
30+
{% endif %}
31+
{% endfor %}
32+
}
33+
34+
{% elif item.number %}
35+
let {{ item.name }} = {{ item.number.value.light }}
36+
{% if item.number.value.dark %}
37+
let {{ item.name }}Dark = {{ item.number.value.dark }}
38+
{% endif %}
39+
{% if item.number.value.highContrast %}
40+
let {{ item.name }}HighContrast = {{ item.number.value.highContrast }}
41+
{% endif %}
42+
{% if item.number.value.darkHighContrast %}
43+
let {{ item.name }}DarkHighContrast = {{ item.number.value.darkHighContrast }}
44+
{% endif %}
45+
46+
{% elif item.boolean %}
47+
let {{ item.name }} = {{ item.boolean.value.light }}
48+
{% if item.boolean.value.dark %}
49+
let {{ item.name }}Dark = {{ item.boolean.value.dark }}
50+
{% endif %}
51+
{% if item.boolean.value.highContrast %}
52+
let {{ item.name }}HighContrast = {{ item.boolean.value.highContrast }}
53+
{% endif %}
54+
{% if item.boolean.value.darkHighContrast %}
55+
let {{ item.name }}DarkHighContrast = {{ item.boolean.value.darkHighContrast }}
56+
{% endif %}
57+
58+
{% elif item.string %}
59+
let {{ item.name }} = "{{ item.string.value.light }}"
60+
{% if item.string.value.dark %}
61+
let {{ item.name }}Dark = "{{ item.string.value.dark }}"
62+
{% endif %}
63+
{% if item.string.value.highContrast %}
64+
let {{ item.name }}HighContrast = "{{ item.string.value.highContrast }}"
65+
{% endif %}
66+
{% if item.string.value.darkHighContrast %}
67+
let {{ item.name }}DarkHighContrast = "{{ item.string.value.darkHighContrast }}"
68+
{% endif %}
69+
70+
{% endif %}
71+
{% endfor %}
72+
}

0 commit comments

Comments
 (0)