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

No enough space between numbers - for style=for-the-badge #3613

Closed
thamaraiselvam opened this issue Jun 27, 2019 · 6 comments · Fixed by #3640
Closed

No enough space between numbers - for style=for-the-badge #3613

thamaraiselvam opened this issue Jun 27, 2019 · 6 comments · Fixed by #3640
Labels
npm-package Badge generation and badge templates

Comments

@thamaraiselvam
Copy link

Packagist Visual Studio Marketplace Downloads Visual Studio Marketplace Installs

There is not enough space between these numbers so hard to read.

It happens when use style=for-the-badge

@thamaraiselvam thamaraiselvam added the question Support questions, usage questions, unconfirmed bugs, discussions, ideas label Jun 27, 2019
@paulmelnikow paulmelnikow added npm-package Badge generation and badge templates and removed question Support questions, usage questions, unconfirmed bugs, discussions, ideas labels Jun 29, 2019
@paulmelnikow
Copy link
Member

Hi, thanks for the report.

The problem is not just numbers, also letters, e.g.


https://img.shields.io/badge/foo-bar-green.svg?style=for-the-badge

It seems like probably one of the issues is that we are displaying bold letters while computing the width using narrower letters. Though something else is causing the letters on the left to be squashed.


https://img.shields.io/badge/FOO-BAR-green.svg?style=for-the-badge

Hmm, maybe we are measuring the lowercase letters…


https://img.shields.io/badge/downloads-5k-green.svg?style=for-the-badge


https://img.shields.io/badge/DOWNLOADS-5K-green.svg?style=for-the-badge

Is the font size different, too?

@u3u
Copy link

u3u commented Jul 1, 2019

Use uppercase spacing is not the same

https://img.shields.io/badge/eslint-airbnb-ff5a5f.svg?style=for-the-badge&logo=airbnb

ESLint Airbnb

https://img.shields.io/badge/ESLint-AirBnb-ff5a5f.svg?style=for-the-badge&logo=airbnb

ESLint Airbnb

Is it possible to provide a parameter to set the spacing?

@thamaraiselvam
Copy link
Author

@paulmelnikow
Copy link
Member

Use uppercase spacing is not the same

Yea, that's definitely a bug we should fix.

This code is in flight as part of #2428, maybe it can be tackled there.

In the meantime you can set ?label=SOMETHING to tweak the spacing. There isn't a way to directlty override it.

@RedSparr0w
Copy link
Member

It's strange that this makes a difference, Maybe the measurements are being done before this step:

} else if (template === 'for-the-badge') {
text = text.map(value => value.toUpperCase())
}

@RedSparr0w
Copy link
Member

Found the problem:
84c60c8#diff-8e42c268a94af1983cbdd09a6bdbe33eR114

This PR changed the text computation to measure left, right instead of text[0], text[1]
But didnt change

} else if (template === 'for-the-badge') {
text = text.map(value => value.toUpperCase())
}

To use left, right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
npm-package Badge generation and badge templates
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants