Skip to content

Encode rem values derived from pixels using rems_from_px - #9367

Merged
maxdeviant merged 2 commits into
mainfrom
marshall/rems-from-px
Mar 14, 2024
Merged

maxdeviant merged 2 commits into
mainfrom
marshall/rems-from-px

Conversation

@maxdeviant

Copy link
Copy Markdown
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
@maxdeviant
maxdeviant deleted the marshall/rems-from-px branch March 14, 2024 20:39
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
…tries#9367)

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
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