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

Refactor monospace font sizes to use CSS variables for consistency #2063

Closed

Conversation

hichemfantar
Copy link
Contributor

@hichemfantar hichemfantar commented Jan 23, 2025

Replace hardcoded font sizes with CSS variables to ensure consistency across the application. Introduce a new variable for small text size.

I've also noticed monospace text became too small in some places when @josevalim tried to compensate for the larger system monospace font rendering in 70acb0d#diff-ff486ec25148e539aaaedfe186ecf1c05b629ff7fe07e5c26040a65eb4193bc0 so this brings the font sizes back to a normal level consistent with the rest of the website, going below 14px is bad for legibility

0.875rem is equivalent to 14px https://v3.tailwindcss.com/docs/font-size

result

image

image

Copy link

github-actions bot commented Jan 23, 2025

@josevalim
Copy link
Member

Which OS are you using? It turns out Inconsolata was smaller than usual (or the one for macOS is larger than usual), so I picked the font sizes that precisely matched the previous font, by comparing the texts side by side.

In any case, I compared your screenshot with https://hexdocs.pm/ex_doc and it is clear that it is increasing the text in most places. I am also almost sure that GitHub uses 12px for inline code, so I don't think it is a general agreement that it has to be at least 14px.

@hichemfantar
Copy link
Contributor Author

hichemfantar commented Jan 23, 2025

Github uses a larger size in markdown code snippets than it does in code files.
also don't compare screenshots, open both pages side by side because screenshots are enlarged and zoomed in on gh and make things look bigger than they really are

@hichemfantar
Copy link
Contributor Author

hichemfantar commented Jan 23, 2025

introduced a font size xs variant if you wish to use it

@josevalim
Copy link
Member

also don't compare screenshots, open both pages side by side because screenshots are enlarged and zoomed in on gh and make things look bigger than they really are

I compared screenshot because I don't know what is your OS. But locally I compared the builds and I also confirmed the sizes are considerably bigger.

Github uses a larger size in markdown code snippets than it does in code files.

If you inspect this piece of code, it shows as 12px for me.

@hichemfantar
Copy link
Contributor Author

I use windows, macos, and ubuntu btw. screenshot is from macos

@josevalim
Copy link
Member

Given the above, the goal is to keep those changes as is for now. Thank you.

@josevalim josevalim closed this Jan 23, 2025
@hichemfantar
Copy link
Contributor Author

hichemfantar commented Jan 23, 2025

If you inspect this piece of code, it shows as 12px for me.

that's because gh uses 14px for regular comment text while we use 16px

@josevalim i believe you've missed this, so the correct size for code is 14px in our case

@hichemfantar
Copy link
Contributor Author

@josevalim
Copy link
Member

We are using 13px for inline code which looks good with 16px, no further changes planned on this. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants