NativeScript / theme

@nativescript/theme
https://v7.docs.nativescript.org/ui/theme
Apache License 2.0
127 stars 44 forks source link

Choosing a different unit than the default one for style classes #284

Closed FestplattenSchnitzel closed 3 years ago

FestplattenSchnitzel commented 3 years ago

Is your feature request related to a problem? Please describe.

It is not possible to use the {N} Theme classes (like h1 or m-10) with units like em, rem, [...]. (Afaik all numbers are in DIP.) So when you set class="h1" you only can get font-size: 32 (which is px or DIP) but not font-size: 32rem.

Describe the solution you'd like

It should be possible to declare the desired "default" unit e.g. in app.scss or main.js. (I do not know where the best place for this would be, because I am technically not into how this could work.) Then every time you call class="h1" you get font-size: 32rem (or whatever unit someone prefers).

I am aware that font-size: 32rem would not be equal to font-size: 32.

Describe alternatives you've considered

An alternative would be to use class="h1-[unit]" (e.g. class="h1-em"), so someone can define the unit each time, like in regular css. That would have the advance that the problem above would be avoided, but it would not be as convenient as the solution above.

Additional context

[none]