如何在 GitHub 仓库中获取 StarGazer 图标

3

我正在尝试在由Nikola生成的静态HTML页面中包含stargazer,它显示了一个repo的星星数量。类似以下内容:

enter image description here

是否有UI代码可供使用?


1
试试 https://buttons.github.io/ - User863
1个回答

6

前往https://buttons.github.io,选择“Star”,并确保已选中“Large button”和“Show count”。现在,您只需复制“Preview and code” <textarea> 字段中的相关HTML即可。

这是您需要的生成代码。

<!-- Place this tag in your head or just before your close body tag. -->
<script async defer src="https://buttons.github.io/buttons.js"></script>

<!-- Place this tag where you want the button to render. -->
<a class="github-button"
   href="https://github.com/buttons/github-buttons"
   data-icon="octicon-star"
   data-size="large"
   data-show-count="true"
   aria-label="Star ntkme/github-buttons on GitHub">Star</a>

这里有一个特定用户和仓库(Facebook React)的暗色版本:

body { background: #222; }
<!-- Place this tag in your head or just before your close body tag. -->
<script async defer src="https://buttons.github.io/buttons.js"></script>

<!-- Place this tag where you want the button to render. -->
<a class="github-button"
   href="https://github.com/facebook/react"
   data-color-scheme="no-preference: dark; light: dark; dark: dark;"
   data-icon="octicon-star"
   data-size="large"
   data-show-count="true"
   aria-label="Star facebook/react on GitHub">Star</a>


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接