#391 Show Codeberg: Readme badge with total stars count (Codeberg + Github)

Open
opened 1 month ago by vladimyr · 2 comments
vladimyr commented 1 month ago

Disclaimer This is not an issue. I apologize for polluting issue tracker but I'm not sure where does Show Codeberg stuff belong. 🤔


As an avid Github stargazer, I was contemplating about Codeberg stars and it occurred to me that projects mirrored between Codeberg and Github suffer from stars fragmentation.

Take teddit for example. As of writing this, it has:

  1. 56 stars on Codeberg (https://codeberg.org/teddit/teddit)
  2. 44 stars on Github (https://github.com/teddit-net/teddit)

Codeberg users might not be aware of Github stars and vice versa. Basically, there is no way for them to show cumulative star count in their Readme which surely doesn't help from a marketing perspective.

As someone who did some https://badgen.net tweaks, I figured out I could probably solve it by creating a small Runkit endpoint utilizing Gitea & Github API.

Few keystrokes later, there you have it 🎉
https://runkit.com/vladimyr/total-stars

It can be used in the following fashion:

![](https://badgen.net/runkit/vladimyr/total-stars/codeberg;owner=teddit;repo=teddit/github;owner=teddit-net;repo=teddit)

which yields this nice total stars badge:

I hope that someone might find it useful 🏄

If you have any questions or improvement suggestions let me know, I'm all ears.

**Disclaimer** This is not an issue. I apologize for _polluting_ issue tracker but I'm not sure where does _Show Codeberg_ stuff belong. :thinking: --- As an avid Github stargazer, I was contemplating about Codeberg stars and it occurred to me that projects mirrored between Codeberg and Github suffer from stars fragmentation. Take teddit for example. As of writing this, it has: 1. 56 stars on Codeberg (https://codeberg.org/teddit/teddit) 2. 44 stars on Github (https://github.com/teddit-net/teddit) Codeberg users might not be aware of Github stars and vice versa. Basically, there is no way for them to show cumulative star count in their Readme which surely doesn't help from a marketing perspective. As someone who did some https://badgen.net tweaks, I figured out I could probably solve it by creating a small [Runkit](https://runkit.com) endpoint utilizing Gitea & Github API. Few keystrokes later, there you have it :tada: https://runkit.com/vladimyr/total-stars It can be used in the following fashion: ```md ![](https://badgen.net/runkit/vladimyr/total-stars/codeberg;owner=teddit;repo=teddit/github;owner=teddit-net;repo=teddit) ``` which yields this nice total stars badge: ![](https://badgen.net/runkit/vladimyr/total-stars/cb;owner=teddit;repo=teddit/gh;owner=teddit-net;repo=teddit) I hope that someone might find it useful :surfer: If you have any questions or improvement suggestions let me know, I'm all ears.
fnetX commented 1 month ago
Poster
Collaborator

Wow, that's awesome. I'm not using badges for my own repos, but I like them in most public ones.
I think we should mention this in the docs.

Is it possible to have a variant with icons? I think it might be an idea to have both icons in the label so the meaning of "total" is more clear. Don't have a clear imagination if it, though.

Wow, that's awesome. I'm not using badges for my own repos, but I like them in most public ones. I think we should mention this in the docs. Is it possible to have a variant with icons? I think it might be an idea to have both icons in the label so the meaning of "total" is more clear. Don't have a clear imagination if it, though.
vladimyr commented 1 month ago
Poster

Is it possible to have a variant with icons? I think it might be an idea to have both icons in the label so the meaning of "total" is more clear. Don't have a clear imagination if it, though.

This endpoint, like all badgen.net powered ones, gives you the ability to specify a single icon. It can be done using several forms of icon query param:

  1. ?icon=<icon> for icons listed on https://badgen.net
  2. ?icon=https://simpleicons.now.sh/<icon>/fff for icons coming from https://simpleicons.org collection

There is an open PR on simpleicons end for adding Codeberg's logo: https://github.com/simple-icons/simple-icons/pull/4757
Once it gets merged you could do something like this:

![](https://badgen.net/runkit/vladimyr/total-stars/codeberg;owner=teddit;repo=teddit/github;owner=teddit-net;repo=teddit?icon=https://simpleicons.now.sh/codeberg/fff)

However, that will still give you only one icon. It would look like this, obviously with Codeberg's logo:

Someone could join together Github's and Codeberg's icons, host them somewhere and use that instead of simpleicons proxy although I don't think that the end result would look attractive. 🤔

> Is it possible to have a variant with icons? I think it might be an idea to have both icons in the label so the meaning of "total" is more clear. Don't have a clear imagination if it, though. This endpoint, like all badgen.net powered ones, gives you the ability to specify a single icon. It can be done using several forms of `icon` query param: 1. `?icon=<icon>` for icons listed on https://badgen.net 2. `?icon=https://simpleicons.now.sh/<icon>/fff` for icons coming from https://simpleicons.org collection There is an open PR on simpleicons end for adding Codeberg's logo: https://github.com/simple-icons/simple-icons/pull/4757 Once it gets merged you could do something like this: ```md ![](https://badgen.net/runkit/vladimyr/total-stars/codeberg;owner=teddit;repo=teddit/github;owner=teddit-net;repo=teddit?icon=https://simpleicons.now.sh/codeberg/fff) ``` However, that will still give you only one icon. It would look like this, obviously with Codeberg's logo: ![](https://badgen.net/runkit/vladimyr/total-stars/codeberg;owner=teddit;repo=teddit/github;owner=teddit-net;repo=teddit?icon=https://simpleicons.now.sh/github/fff) Someone could join together Github's and Codeberg's icons, host them somewhere and use that instead of simpleicons proxy although I don't think that the end result would look attractive. :thinking:
Sign in to join this conversation.
Loading…
There is no content yet.