前往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>