Skip to content

Commit 852105a

Browse files
committed
refactor: Support light and dark background logos for premium sponsors
1 parent f41edb4 commit 852105a

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

project/docs/js/{% if insiders %}insiders.js{% endif %}.jinja

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,14 @@ function updatePremiumSponsors(dataURL, rank) {
2929
let html = '';
3030
html += `<b>${capRank} sponsors</b><p>`
3131
sponsors.forEach(function (sponsor) {
32-
html += `
33-
<a href="${sponsor.url}" target="_blank" title="${sponsor.name}">
34-
<img alt="${sponsor.name}" src="${sponsor.image}" style="height: ${sponsor.imageHeight}px;">
35-
</a>
36-
`
32+
html += `<a href="${sponsor.url}" target="_blank" title="${sponsor.name}">`
33+
if (sponsor.image) {
34+
html += `<img alt="${sponsor.name}" src="${sponsor.image}" style="height: ${sponsor.imageHeight}px;">`
35+
} else if (sponsor.imageLight && sponsor.imageDark) {
36+
html += `<img alt="${sponsor.name}" src="${sponsor.imageLight}#only-light" style="height: ${sponsor.imageHeight}px;">`
37+
html += `<img alt="${sponsor.name}" src="${sponsor.imageDark}#only-dark" style="height: ${sponsor.imageHeight}px;">`
38+
}
39+
html += '</a>';
3740
});
3841
html += '</p>'
3942
sponsorsDiv.innerHTML = html;

0 commit comments

Comments
 (0)