Github徽标

  1. github徽标可以直接通过shields.io在线生成。
  2. 理论上可以放在页面的任何地方。教程案例是添加在页脚。
  3. 工具网站包括:

具体步骤

1.通过shields.io在线生成。

  • label:标签,徽标左侧内容
  • message:信息,徽标右侧内容
  • color:色值,支持支持十六进制、rgb、rgba、hsl、hsla和 css 命名颜色。十六进制记得删除前面的#号

2.输入相关信息后,点击make badge即可得到徽标的URL。可以用img标签引用,写法简单。不过正式写法建议用object标签引用,写法示例如下:

<!-- label=Frame,Message=Hexo,color=blue -->
https://img.shields.io/badge/Frame-Hexo-blue
<!-- 在页面上可以使用img标签来引用 -->
<img src="https://img.shields.io/badge/Frame-Hexo-blue">
<!-- 部分属性例如link需要用object标签来引用 -->
<object data="https://img.shields.io/badge/Frame-Hexo-blue?link=https://hexo.io"></object>

3.拓展写法示例

仅仅如此肯定是不能令人满意的,还可以继续添加样式。
shields.io提供直接在URL内添加样式属性的功能。使用?引用,使用&连接各属性。

属性 说明 示例
style 徽标样式,默认提供了五种样式: plastic,flat,flat-square, for-the-badge,social ?style=flat-square
label 覆盖默认的左侧文本 (空格或特殊字符需要转URL编码!) ?label=healthinesses
logo 给左侧标签前插入图标 可以访问simpleicons查询图标 ?logo=Hexo
logo 自定义图标, 限制较多,不推荐 ?logo=data:image/png;base64,url
logoColor 设置徽标的颜色 (支持十六进制、rgb、 rgba、hsl、hsla 和 css 命名颜色)。 支持命名徽标, 但不支持自定义徽标。 ?logoColor=violet
logoWidth 给图标提供的水平空间 ?logoWidth=40
link 徽标指向的链接, 此时需要用object标签 引用才能生效 写法看示例代码 ?link=http://example.com
labelColor 左侧部分背景色, (支持十六进制、rgb、 rgba、hsl、hsla 和 css 命名颜色) ?labelColor=abcdef 或者?colorA=abcdef
color 右侧部分背景色, (支持十六进制、rgb、 rgba、hsl、hsla 和 css 命名颜色) ?color=fedcba或者?colorB=fedcba

1.普通样式

2.五种style预览





3.添加图标和自定义label

4.添加图标和图标宽度

5.图标、label、message三部分颜色自定义

6.给标签添加链接

7.可以通过嵌套a标签来实现添加链接

<!-- 普通样式 -->
<img src="https://img.shields.io/badge/Frame-Hexo-blue">
<!-- 五种style预览 -->
<img src="https://img.shields.io/badge/Frame-Hexo-blue?logo=Hexo&style=plastic">
<img src="https://img.shields.io/badge/Frame-Hexo-blue?logo=Hexo&style=flat">
<img src="https://img.shields.io/badge/Frame-Hexo-blue?logo=Hexo&style=flat-square">
<img src="https://img.shields.io/badge/Frame-Hexo-blue?logo=Hexo&style=for-the-badge">
<img src="https://img.shields.io/badge/Frame-Hexo-blue?logo=Hexo&style=social">
<!-- 添加图标和自定义label -->
<img src="https://img.shields.io/badge/Frame-Hexo-blue?logo=Hexo&label=框架">
<!-- 添加图标和图标宽度 -->
<img src="https://img.shields.io/badge/Frame-Hexo-blue?logo=Hexo&logoWidth=30">
<!-- 图标、label、message三部分颜色自定义 -->
<img src="https://img.shields.io/badge/Frame-Hexo-blue?logo=Hexo&label=框架&logoColor=violet&labalColor=#1fd041&color=rgb(222, 31, 31)">
<!-- 给标签添加链接 -->
<object data="https://img.shields.io/badge/Frame-Hexo-blue?logo=Hexo&link=https://hexo.io/&https://hexo.io/zh-cn/docs/"></object>
<!-- 也可以通过嵌套a标签来实现添加链接 -->
<a target="_blank" href="https://hexo.io" title="框架采用Hexo"><img src="https://img.shields.io/badge/Frame-Hexo-blue"></a>

4.在[Blogroot]\_config.butterfly.ymlfooter配置项中添加徽标,注意事先压缩一下,使他们只留一行。为了不至于太过紧凑,设置一下行内间隔属性margin-inline

      footer:
        owner:
          enable: true
          since: 2016
-       custom_text:
+       custom_text: <p><a style="margin-inline:5px" target="_blank" href="https://hexo.io/"><img src="https://img.shields.io/badge/Frame-Hexo-blue?style=flat&logo=hexo" title="博客框架为Hexo"></a><a style="margin-inline:5px" target="_blank" href="https://butterfly.js.org/"><img src="https://img.shields.io/badge/Theme-Butterfly-6513df?style=flat&logo=bitdefender" title="主题采用butterfly"></a><a style="margin-inline:5px" target="_blank" href="https://www.jsdelivr.com/"><img src="https://img.shields.io/badge/CDN-jsDelivr-orange?style=flat&logo=jsDelivr" title="本站使用JsDelivr为静态资源提供CDN加速"></a><a style="margin-inline:5px" target="_blank" href="https://vercel.com/ "><img src="https://img.shields.io/badge/Hosted-Vercel-brightgreen?style=flat&logo=Vercel" title="本站采用双线部署,默认线路托管于Vercel"></a><a style="margin-inline:5px" target="_blank" href="https://vercel.com/ "><img src="https://img.shields.io/badge/Hosted-Coding-0cedbe?style=flat&logo=Codio" title="本站采用双线部署,联通线路托管于Coding"></a><a style="margin-inline:5px" target="_blank" href="https://github.com/"><img src="https://img.shields.io/badge/Source-Github-d021d6?style=flat&logo=GitHub" title="本站项目由Github托管"></a><a style="margin-inline:5px" target="_blank" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img src="https://img.shields.io/badge/Copyright-BY--NC--SA%204.0-d42328?style=flat&logo=Claris" title="本站采用知识共享署名-非商业性使用-相同方式共享4.0国际许可协议进行许可"></a></p>
        copyright: false # Copyright of theme and framework
        ICP: # Chinese ICP License

常用徽章【可以直接用哦】

(1).找到合适的图标图片,建议先行用PS抠图成透明背景,然后存储为png格式,此时,要记得尽量将图片的尺寸调整的小一点,这样转的base64图片链接才不至于过长。

(2).找个在线转base64图片的网站,把制作好的图片转为base64链接。这里推荐用

UrlEncode编码/UrlDecode解码 - 站长工具 (chinaz.com)

BASE64转图片 - 站长工具 - 极速数据 (jisuapi.com)

(3).把base64链接作为logo填进徽标链接。

1.公安备案徽章

<p><a style="margin-inline:5px"target="_blank" href="http://www.beian.gov.cn/portal/index.do"><img src="https://img.shields.io/badge/%E5%86%80%E5%85%AC%E5%AE%89%E5%A4%87-1111111%E5%8F%B7--1-e1d492?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAdCAYAAAC9pNwMAAABS2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjem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zleUbvQyWRTuE5xYthxQbBs7EISAbkzUFG3VfXXbK2YFi3X/eryfKKnqVBItNjJxDzH8erddC4SqWwcN5WyTtlyO1RP/Lh3eHD76MB40swmiDVJyDLYRhpc5+ub6tse/wWKbvSQEAw1awAAAABJRU5ErkJggg==" title="公安备案"></a></p>

在相关代码中找到

%E5%86%80%E5%85%AC%E5%AE%89%E5%A4%87-1111111%E5%8F%B7--1

使用UrlEncode编码/UrlDecode解码 - 站长工具 (chinaz.com) UrlEncode解码即可解码成:冀公安备-1111111号—1,修改成自己的,然后点击UrlEncode编码替换相应的即可

2.萌ICP备案徽章

<p><a style="margin-inline:5px"target="_blank" href="https://icp.gov.moe/"><img src="https://img.shields.io/badge/%E8%90%8CICP%E5%A4%87-20210100-fe1384?style-flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAABS2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDIgNzkuMTYwOTI0LCAyMDE3LzA3LzEzLTAxOjA2OjM5ICAgICAgICAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIi8+CiA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgo8P3hwYWNrZXQgZW5kPSJyIj8+nhxg7wAAByxJREFUSInl1nlwVeUZx/HPuTckkD0kQFiCEEIUlNUCAqKoSBV1AIt1ikpVLFbLONjWGUXbmWrbweJMy7hUxbbTjsUq6KCiWEvr0kE2WVK2QCKBJCxJgEASsienfxwqMob+3Zm+f93z3v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KzmRQMq0d51J8UxL+23d1TDTcj7WQllZu4YwxDo+eZc22X9mwd6gN65GIFmQzampxcMOoR1xeuMbpVoqromsXdG3+wmCiekNtfSSmiUNWu2zgap+WjlZW8X11TeNkpWwICvNfCm8u3Cmxg4PN0VdmEJw7/7+0/g32RaqCbhRecAAAAABJRU5ErkJggg== title="萌ICP备案"></a></p>

在相关代码中找到

%E8%90%8CICP%E5%A4%87-20210100

使用UrlEncode编码/UrlDecode解码 - 站长工具 (chinaz.com) UrlEncode解码即可解码成:冀公安备-1111111号—1,修改成自己的,然后点击UrlEncode编码替换相应的即可

此文章借鉴:

Akilarの糖果屋 - Akilar.top