Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styles as supported by GITLAB and Shields.io #208

Open
krishvk opened this issue May 2, 2020 · 11 comments
Open

Styles as supported by GITLAB and Shields.io #208

krishvk opened this issue May 2, 2020 · 11 comments
Labels
enhancement New feature or request

Comments

@krishvk
Copy link

krishvk commented May 2, 2020

Is it possible to use/support styles like other alternatives (GItlab and Shields.io)

image

@psincraian psincraian added the enhancement New feature or request label May 2, 2020
@psincraian
Copy link
Owner

Hi,

Thanks for the suggestion!

It's possible but it will require some work, I will try to prioritize it based on the demand for it 😊

@hugovk
Copy link
Contributor

hugovk commented May 2, 2020

Would it be possible for shields.io to provide the badges? They have many different options.

@ffe4
Copy link

ffe4 commented Aug 15, 2020

@hugovk there is a guide on the shields GitHub repo on how to add a badge for a service

@finnmglas
Copy link

I suppose that it would be useful to at least implement the common GET arguments that https://shields.io implements:

label=<LABEL>&message=<MESSAGE>&color=<COLOR> plus the style argument

@finnmglas
Copy link

@krishvk Here is a inofficial implementation based on a comment by @psincraian :

plastic:

flat:

flat-square:

social:

generally something like this (don't forget to adjust the parameters, style etc):

![](https://img.shields.io/badge/dynamic/json?style=<STYLE>&label=downloads&query=%24.total_downloads&url=https%3A%2F%2Fapi.pepy.tech%2Fapi%2Fprojects%2Frequests)

I am not sure if this helps you, but it helped me ^^

@WenjieDu
Copy link

WenjieDu commented Jul 7, 2023

@krishvk Here is a inofficial implementation based on a comment by @psincraian :

plastic:

flat:

flat-square:

social:

generally something like this (don't forget to adjust the parameters, style etc):

![](https://img.shields.io/badge/dynamic/json?style=<STYLE>&label=downloads&query=%24.total_downloads&url=https%3A%2F%2Fapi.pepy.tech%2Fapi%2Fprojects%2Frequests)

I am not sure if this helps you, but it helped me ^^

It seems that the examples provided by @finnmglas are down, showing "resource not found".

@aMahanna
Copy link

It seems that the examples provided by @finnmglas are down, showing "resource not found".

@WenjieDu

Looks like the route changed - adding v2/ to the path seems to fix it:

Set the url query parameter of the img.shields.io API to https://api.pepy.tech/api/v2/projects/requests (instead of https://api.pepy.tech/api/projects/requests

https://img.shields.io/badge/dynamic/json?style=for-the-badge&label=downloads&query=%24.total_downloads&url=https%3A%2F%2Fapi.pepy.tech%2Fapi%2Fv2%2Fprojects%2Frequests

@WenjieDu
Copy link

Awesome! Thank you for your information @aMahanna 😊

@WenjieDu
Copy link

@aMahanna BTW, do you know how to make the displayed number of downloads be an abbreviation (e.g. 17K), rather than an exact number (e.g. 17342)? I tried to look for PePy documentation but failed. 🥲

@aMahanna
Copy link

aMahanna commented Jul 20, 2023

@WenjieDu So the static.pepy.tech API allows you to abbreviate the number with the units=abbreviation query parameter

Downloads

[![Downloads](https://static.pepy.tech/personalized-badge/requests?period=week&units=abbreviation&left_color=black&right_color=blue&left_text=Downloads)](https://pepy.tech/project/requests)

But unfortunately I am not sure how this query parameter would work if we are relying on the img.shields.io API to add a custom style

@WenjieDu
Copy link

WenjieDu commented Jul 20, 2023

@WenjieDu So the static.pepy.tech API allows you to abbreviate the number with the units=abbreviation query parameter

Downloads

[![Downloads](https://static.pepy.tech/personalized-badge/requests?period=week&units=abbreviation&left_color=black&right_color=blue&left_text=Downloads)](https://pepy.tech/project/requests)

But unfortunately I am not sure how this query parameter would work if we are relying on the img.shields.io API to add a custom style

Right, that's true. api.pepy.tech only provides the exact number. It seems that shields.io doesn't offer such a function for abbreviation. Thank you anyway!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants