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

Encode rem values derived from pixels using rems_from_px #9367

Merged
merged 2 commits into from
Mar 14, 2024

Conversation

maxdeviant
Copy link
Member

This PR adds a new rems_from_px helper function that can be used to compute rem values based on a pixel value.

This is something we do fairly commonly, where we want to express a size that is a given pixel size at the base rem size (e.g., "14px when the rem size is 16px").

rems_from_px helps make the intent more explicit, as well as prevent the base rem size from being duplicated everywhere.

Note: Ideally we would want rems_from_px to be const, but that depends on rust-lang/rust#57241.

Release Notes:

  • N/A

@maxdeviant maxdeviant self-assigned this Mar 14, 2024
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 14, 2024
@maxdeviant maxdeviant merged commit 404adbc into main Mar 14, 2024
9 checks passed
@maxdeviant maxdeviant deleted the marshall/rems-from-px branch March 14, 2024 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant