mirror of
https://github.com/reiyua/github-profile-trophy-reiyua-mirror.git
synced 2026-11-17 06:02:09 +11:00
Fix plus icon
This commit is contained in:
parent
be69146a34
commit
dc5b089e37
1 changed files with 20 additions and 12 deletions
30
src/icons.ts
30
src/icons.ts
|
|
@ -3,7 +3,8 @@ import { RANK } from "./utils.ts";
|
|||
const goldColor = "#FFD700";
|
||||
const silverColor = "#C0C0C0";
|
||||
const bronzeColor = "#816D46";
|
||||
const leafIcon = `<svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="90pt" height="90pt" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid meet">
|
||||
const leafIcon =
|
||||
`<svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="90pt" height="90pt" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid meet">
|
||||
<metadata>
|
||||
Created by potrace 1.15, written by Peter Selinger 2001-2017
|
||||
</metadata>
|
||||
|
|
@ -24,26 +25,31 @@ Created by potrace 1.15, written by Peter Selinger 2001-2017
|
|||
<path d="M5255 1054 c-276 -46 -587 -227 -935 -541 l-54 -50 74 -23 c41 -13 67 -25 58 -27 -23 -6 -34 -48 -20 -78 16 -35 75 -61 188 -84 568 -115 968 -37 1250 243 69 69 110 130 114 171 5 42 0 66 -12 59 -12 -8 -12 -7 39 73 18 29 33 56 33 62 0 15 -49 46 -147 95 -207 104 -386 135 -588 100z"/>
|
||||
<path d="M7249 1054 c-42 -7 -109 -25 -150 -40 -76 -27 -226 -101 -267 -133 l-24 -18 41 -66 c22 -37 36 -67 31 -67 -18 0 -11 -80 11 -121 11 -22 53 -73 92 -113 279 -282 682 -361 1251 -245 113 23 172 49 188 84 14 30 3 72 -20 77 -9 3 18 15 61 29 l78 24 -93 81 c-362 313 -622 460 -902 509 -106 18 -194 18 -297 -1z"/>
|
||||
</g>
|
||||
</svg>`
|
||||
const plusIcon = `
|
||||
<text x="8.6" y="5.5" font-family="Verdana, Arial, Helvetica, sans-serif" fill="#fff" font-weight="bold" font-size="5">+</text>
|
||||
<text x="9.4" y="5.0" font-family="Verdana, Arial, Helvetica, sans-serif" fill="#333" font-size="3.5">+</text>
|
||||
</svg>`;
|
||||
function getPlusIcon(color: string): string {
|
||||
return `
|
||||
<svg x="65" y="20" width="100" height="100" viewBox="0 0 30 30" class="bi bi-trophy" fill="${color}" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="8" cy="6" r="3" />
|
||||
<text x="5.5" y="7.9" font-family="Verdana, Arial, Helvetica, sans-serif" fill="#fff" font-weight="bold" font-size="6">+</text>
|
||||
</svg>
|
||||
`;
|
||||
}
|
||||
export function getTropyIcon(rank = RANK.UNKNOWN) {
|
||||
let color = "currentColor"
|
||||
let color = "currentColor";
|
||||
let backgroundIcon = "";
|
||||
let optionRankIcon = "";
|
||||
if (rank == RANK.SP) {
|
||||
color = goldColor;
|
||||
backgroundIcon = leafIcon;
|
||||
optionRankIcon = plusIcon;
|
||||
}else if (rank == RANK.S) {
|
||||
optionRankIcon = getPlusIcon(color);
|
||||
} else if (rank == RANK.S) {
|
||||
color = goldColor;
|
||||
backgroundIcon = leafIcon;
|
||||
optionRankIcon = getPlusIcon(color);
|
||||
} else if (rank == RANK.AP) {
|
||||
color = silverColor;
|
||||
backgroundIcon = leafIcon;
|
||||
optionRankIcon = plusIcon;
|
||||
optionRankIcon = getPlusIcon(color);
|
||||
} else if (rank == RANK.A) {
|
||||
color = silverColor;
|
||||
backgroundIcon = leafIcon;
|
||||
|
|
@ -52,13 +58,15 @@ export function getTropyIcon(rank = RANK.UNKNOWN) {
|
|||
}
|
||||
return `
|
||||
${backgroundIcon}
|
||||
${optionRankIcon}
|
||||
<svg x="28" y="20" width="100" height="100" viewBox="0 0 30 30" class="bi bi-trophy" fill="${color}" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M3 1h10c-.495 3.467-.5 10-5 10S3.495 4.467 3 1zm0 15a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1H3zm2-1a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1H5z"/>
|
||||
<path fill-rule="evenodd" d="M12.5 3a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm-3 2a3 3 0 1 1 6 0 3 3 0 0 1-6 0zm-6-2a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm-3 2a3 3 0 1 1 6 0 3 3 0 0 1-6 0z"/>
|
||||
<path d="M7 10h2v4H7v-4z"/>
|
||||
<path d="M10 11c0 .552-.895 1-2 1s-2-.448-2-1 .895-1 2-1 2 .448 2 1z"/>
|
||||
<circle cx="8" cy="6" r="4" fill="#fff" />
|
||||
${optionRankIcon}
|
||||
<text x="6" y="8" font-family="Courier, Monospace" font-size="7" fill="#333">${rank.replace("+", "")}</text>
|
||||
<text x="6" y="8" font-family="Courier, Monospace" font-size="7" fill="#333">${
|
||||
rank.replace("+", "")
|
||||
}</text>
|
||||
</svg>`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue