Open History to see the last commit
1import Svg, { Circle, Defs, G, LinearGradient, Path, Stop } from "react-native-svg";
2import { withUniwind } from "uniwind";
3
4const ThemedSvg = withUniwind(Svg);
5
6export type SourceControlIconKind = "github" | "gitlab" | "forgejo" | "bitbucket" | "azure-devops";
7
8export function SourceControlIcon(props: {
9 readonly kind: SourceControlIconKind;
10 readonly size?: number;
11 readonly color?: string;
12 readonly colorClassName?: string;
13}) {
14 const size = props.size ?? 18;
15
16 switch (props.kind) {
17 case "forgejo":
18 // Official two-color mark from https://forgejo.org/favicon.svg.
19 return (
20 <Svg width={size} height={size} viewBox="0 0 212 212">
21 <G transform="translate(6 6)" fill="none">
22 <Path d="M58 168 v-98 a50 50 0 0 1 50-50 h20" stroke="#ff6600" strokeWidth={25} />
23 <Path d="M58 168 v-30 a50 50 0 0 1 50-50 h20" stroke="#d40000" strokeWidth={25} />
24 <Circle cx={142} cy={20} r={18} stroke="#ff6600" strokeWidth={15} />
25 <Circle cx={142} cy={88} r={18} stroke="#d40000" strokeWidth={15} />
26 <Circle cx={58} cy={180} r={18} stroke="#d40000" strokeWidth={15} />
27 </G>
28 </Svg>
29 );
30 case "github":
31 return (
32 <ThemedSvg
33 width={size}
34 height={size}
35 viewBox="0 0 16 16"
36 color={props.color}
37 colorClassName={props.colorClassName}
38 fill="none"
39 >
40 <Path
41 fillRule="evenodd"
42 clipRule="evenodd"
43 d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82A7.68 7.68 0 0 1 8.02 3.86c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"
44 fill="currentColor"
45 />
46 </ThemedSvg>
47 );
48 case "gitlab":
49 return (
50 <Svg width={size} height={size} viewBox="0 0 32 32" fill="none">
51 <Path
52 d="m31.46 12.78-.04-.12-4.35-11.35A1.14 1.14 0 0 0 25.94.6c-.24 0-.47.1-.66.24-.19.15-.33.36-.39.6l-2.94 9h-11.9l-2.94-9A1.14 1.14 0 0 0 6.07.58a1.15 1.15 0 0 0-1.14.72L.58 12.68l-.05.11a8.1 8.1 0 0 0 2.68 9.34l.02.01.04.03 6.63 4.97 3.28 2.48 2 1.52a1.35 1.35 0 0 0 1.62 0l2-1.52 3.28-2.48 6.67-5h.02a8.09 8.09 0 0 0 2.7-9.36Z"
53 fill="#E24329"
54 />
55 <Path
56 d="m31.46 12.78-.04-.12a14.75 14.75 0 0 0-5.86 2.64l-9.55 7.24 6.09 4.6 6.67-5h.02a8.09 8.09 0 0 0 2.67-9.36Z"
57 fill="#FC6D26"
58 />
59 <Path
60 d="m9.9 27.14 3.28 2.48 2 1.52a1.35 1.35 0 0 0 1.62 0l2-1.52 3.28-2.48-6.1-4.6-6.07 4.6Z"
61 fill="#FCA326"
62 />
63 <Path
64 d="M6.44 15.3a14.71 14.71 0 0 0-5.86-2.63l-.05.12a8.1 8.1 0 0 0 2.68 9.34l.02.01.04.03 6.63 4.97 6.1-4.6-9.56-7.24Z"
65 fill="#FC6D26"
66 />
67 </Svg>
68 );
69 case "azure-devops":
70 // Microsoft Azure DevOps mark via selfhst/icons (CC BY 4.0): https://github.com/selfhst/icons/blob/main/svg/azure-devops.svg
71 return (
72 <Svg width={size} height={size} viewBox="0 0 512 512">
73 <Defs>
74 <LinearGradient
75 id="azure-a"
76 x1="58.027"
77 x2="58.027"
78 y1="356.668"
79 y2="100.668"
80 gradientTransform="matrix(1 0 0 -1 0 514)"
81 gradientUnits="userSpaceOnUse"
82 >
83 <Stop offset="0" stopColor="#163697" />
84 <Stop offset=".276" stopColor="#2052cb" />
85 <Stop offset=".518" stopColor="#2764e7" />
86 <Stop offset=".879" stopColor="#367af2" />
87 </LinearGradient>
88 <LinearGradient
89 id="azure-b"
90 x1="58.027"
91 x2="58.027"
92 y1="351.334"
93 y2="292.668"
94 gradientTransform="matrix(1 0 0 -1 0 514)"
95 gradientUnits="userSpaceOnUse"
96 >
97 <Stop offset="0" stopColor="#102784" />
98 <Stop offset="1" stopColor="#2052cb" stopOpacity="0" />
99 </LinearGradient>
100 <LinearGradient
101 id="azure-c"
102 x1="389.98"
103 x2="107.314"
104 y1="57.935"
105 y2="193.935"
106 gradientTransform="matrix(1 0 0 -1 0 514)"
107 gradientUnits="userSpaceOnUse"
108 >
109 <Stop offset="0" stopColor="#163697" />
110 <Stop offset=".301" stopColor="#2052cb" />
111 <Stop offset=".626" stopColor="#2764e7" />
112 <Stop offset=".926" stopColor="#367af2" />
113 </LinearGradient>
114 <LinearGradient
115 id="azure-d"
116 x1="391.996"
117 x2="341.385"
118 y1="76.552"
119 y2="78.224"
120 gradientTransform="matrix(1 0 0 -1 0 514)"
121 gradientUnits="userSpaceOnUse"
122 >
123 <Stop offset="0" stopColor="#102784" />
124 <Stop offset="1" stopColor="#2052cb" stopOpacity="0" />
125 </LinearGradient>
126 <LinearGradient
127 id="azure-e"
128 x1="442.24"
129 x2="442.24"
130 y1="54.769"
131 y2="419.38"
132 gradientTransform="matrix(1 0 0 -1 0 514)"
133 gradientUnits="userSpaceOnUse"
134 >
135 <Stop offset=".043" stopColor="#2052cb" />
136 <Stop offset=".489" stopColor="#367af2" />
137 <Stop offset=".943" stopColor="#16bbda" />
138 </LinearGradient>
139 <LinearGradient
140 id="azure-f"
141 x1="435.596"
142 x2="425.732"
143 y1="270.413"
144 y2="385.266"
145 gradientTransform="matrix(1 0 0 -1 0 514)"
146 gradientUnits="userSpaceOnUse"
147 >
148 <Stop offset=".134" stopColor="#16bbda" stopOpacity="0" />
149 <Stop offset=".932" stopColor="#6be7a0" stopOpacity=".8629" />
150 </LinearGradient>
151 <LinearGradient
152 id="azure-g"
153 x1="437.081"
154 x2="507.893"
155 y1="204.362"
156 y2="119.081"
157 gradientTransform="matrix(1 0 0 -1 0 514)"
158 gradientUnits="userSpaceOnUse"
159 >
160 <Stop offset="0" stopColor="#2c68e0" stopOpacity="0" />
161 <Stop offset=".898" stopColor="#66c0ff" stopOpacity=".5" />
162 </LinearGradient>
163 <LinearGradient
164 id="azure-h"
165 x1="99.399"
166 x2="352.75"
167 y1="279.26"
168 y2="498.676"
169 gradientTransform="matrix(1 0 0 -1 0 514)"
170 gradientUnits="userSpaceOnUse"
171 >
172 <Stop offset=".005" stopColor="#367af2" />
173 <Stop offset=".507" stopColor="#0fafff" />
174 <Stop offset="1" stopColor="#26cfe8" />
175 </LinearGradient>
176 <LinearGradient
177 id="azure-i"
178 x1="184.342"
179 x2="338.581"
180 y1="356.795"
181 y2="480.642"
182 gradientTransform="matrix(1 0 0 -1 0 514)"
183 gradientUnits="userSpaceOnUse"
184 >
185 <Stop offset=".443" stopColor="#26cfe8" stopOpacity="0" />
186 <Stop offset=".897" stopColor="#6be7a0" stopOpacity=".8629" />
187 </LinearGradient>
188 </Defs>
189 <Path
190 d="M116.1 73.4c-5.8 5.8-13.7 13.8-13.7 22.6v216.4c0 8.9-3.3 17.3-9 23.4s-13.3 9.2-21.1 8.5l-42.7-3.1c-7.9-.5-15-3.9-20.3-9.3-5.7-5.7-9.3-13.7-9.3-22.6V202.7c0-8.9 3.6-16.9 9.4-22.6l2-1.9z"
191 fill="url(#azure-a)"
192 />
193 <Path
194 d="M116.1 73.4c-5.8 5.8-13.7 13.8-13.7 22.6v216.4c0 8.9-3.3 17.3-9 23.4s-13.3 9.2-21.1 8.5l-42.7-3.1c-7.9-.5-15-3.9-20.3-9.3-5.7-5.7-9.3-13.7-9.3-22.6V202.7c0-8.9 3.6-16.9 9.4-22.6l2-1.9z"
195 fill="url(#azure-b)"
196 />
197 <Path
198 d="m500.5 366-128 106.7c-5.5 4.6-12.7 7.4-20.5 7.4q-2.4 0-4.8-.3l-112.5-16.9v27.8c0 11.7-9.6 21.3-21.3 21.3-7.3 0-13.5-3.6-17.5-9.1l-36.2-51.4-5.4-7.6-36.6-51.9-7-10c-2.6-3.5-3.9-7.8-3.9-12.3 0-6 2.5-11.6 6.8-15.7 3.8-3.7 9.1-5.8 14.5-5.8.4 0 1 .1 1.5.1l105.2 7.5L384 366.5l93.7 6.7c.7.1 1.6.1 2.3.1 7.8 0 14.9-2.7 20.5-7.3"
199 fill="url(#azure-c)"
200 />
201 <Path
202 d="m500.5 366-128 106.7c-5.5 4.6-12.7 7.4-20.5 7.4q-2.4 0-4.8-.3l-112.5-16.9v27.8c0 11.7-9.6 21.3-21.3 21.3-7.3 0-13.5-3.6-17.5-9.1l-36.2-51.4-5.4-7.6-36.6-51.9-7-10c-2.6-3.5-3.9-7.8-3.9-12.3 0-6 2.5-11.6 6.8-15.7 3.8-3.7 9.1-5.8 14.5-5.8.4 0 1 .1 1.5.1l105.2 7.5L384 366.5l93.7 6.7c.7.1 1.6.1 2.3.1 7.8 0 14.9-2.7 20.5-7.3"
203 fill="url(#azure-d)"
204 />
205 <Path
206 d="M512 170.7v170.7c0 9.9-4.5 18.8-11.5 24.6l-128 106.7c7-5.9 11.5-14.7 11.5-24.6V175.3c0-16.7 13-30.7 29.8-31.9l63.9-4.6c.7-.1 1.6-.1 2.3-.1 7.8 0 14.9 2.8 20.5 7.4 7 5.8 11.5 14.6 11.5 24.6"
207 fill="url(#azure-e)"
208 />
209 <Path
210 d="M512 170.7v170.7c0 9.9-4.5 18.8-11.5 24.6l-128 106.7c7-5.9 11.5-14.7 11.5-24.6V175.3c0-16.7 13-30.7 29.8-31.9l63.9-4.6c.7-.1 1.6-.1 2.3-.1 7.8 0 14.9 2.8 20.5 7.4 7 5.8 11.5 14.6 11.5 24.6"
211 fill="url(#azure-f)"
212 fillOpacity=".7"
213 />
214 <Path
215 d="M512 170.7v170.7c0 9.9-4.5 18.8-11.5 24.6l-128 106.7c7-5.9 11.5-14.7 11.5-24.6V175.3c0-16.7 13-30.7 29.8-31.9l63.9-4.6c.7-.1 1.6-.1 2.3-.1 7.8 0 14.9 2.8 20.5 7.4 7 5.8 11.5 14.6 11.5 24.6"
216 fill="url(#azure-g)"
217 />
218 <Path
219 d="M384 125.5c0 11.2-8.6 20.5-19.8 21.3-.5 0-1.1.1-1.6.1l-127.9 9.2-132.3 9.1-72.7 5.5c-6.9.4-13.2 3.1-18.2 7.4L116.1 73.4c4.7-4.7 10.9-8 17.8-9.1l100.8-15.1V21.3C234.7 9.6 244.3 0 256 0c5.8 0 11.1 2.3 14.9 6.1l33.4 32.6 16.9 16.5 40.3 39.3 16.1 15.8c4.1 3.9 6.4 9.4 6.4 15.2"
220 fill="url(#azure-h)"
221 />
222 <Path
223 d="M384 125.5c0 11.2-8.6 20.5-19.8 21.3-.5 0-1.1.1-1.6.1l-127.9 9.2-132.3 9.1-72.7 5.5c-6.9.4-13.2 3.1-18.2 7.4L116.1 73.4c4.7-4.7 10.9-8 17.8-9.1l100.8-15.1V21.3C234.7 9.6 244.3 0 256 0c5.8 0 11.1 2.3 14.9 6.1l33.4 32.6 16.9 16.5 40.3 39.3 16.1 15.8c4.1 3.9 6.4 9.4 6.4 15.2"
224 fill="url(#azure-i)"
225 fillOpacity=".5"
226 />
227 </Svg>
228 );
229 case "bitbucket":
230 return (
231 <Svg width={size} height={size} viewBox="8.4 14.39 2481.29 2231.21">
232 <Defs>
233 <LinearGradient
234 id="bitbucket-a"
235 x1="945.1094"
236 y1="1524.8389"
237 x2="944.4923"
238 y2="1524.1893"
239 gradientTransform="matrix(1996.6343 0 0 -1480.3047 -1884485.625 2258195)"
240 >
241 <Stop offset="0.18" stopColor="#0052CC" />
242 <Stop offset="1" stopColor="#2684FF" />
243 </LinearGradient>
244 </Defs>
245 <Path
246 fill="#2684FF"
247 d="M88.92,14.4C45.02,13.83,8.97,48.96,8.41,92.86c-0.06,4.61,0.28,9.22,1.02,13.77l337.48,2048.72 c8.68,51.75,53.26,89.8,105.74,90.24h1619.03c39.38,0.5,73.19-27.9,79.49-66.78l337.49-2071.78c7.03-43.34-22.41-84.17-65.75-91.2 c-4.55-0.74-9.15-1.08-13.76-1.02L88.92,14.4z M1509.99,1495.09H993.24l-139.92-731h781.89L1509.99,1495.09z"
248 />
249 <Path
250 fill="url(#bitbucket-a)"
251 d="M2379.27,763.06h-745.5l-125.12,730.42H992.31l-609.67,723.67c19.32,16.71,43.96,26,69.5,26.21h1618.13 c39.35,0.51,73.14-27.88,79.44-66.72L2379.27,763.06z"
252 />
253 </Svg>
254 );
255 }
256}