Sass Mixins

The screen mixins generate device-aware rules from the same grammar the responsive utility classes use: size, orientation, and bit depth. The scale functions wrap pixel values so custom CSS scales with the device like framework CSS does.

@use 'framework/mixins' as trmnl;

.forecast-tile {
    border: 1px solid var(--black);

    // 1-bit screens: thicker rule so the dithered edge stays legible.
    @include trmnl.for-1bit {
        border-width: 2px;
    }

    // md and larger screens in portrait.
    @include trmnl.screen('md', 'portrait') {
        padding: 20px;
    }
}

A mixin wraps the current rule in the matching screen ancestor: the 1-bit block above compiles to .trmnl .screen--1bit .forecast-tile.

#

Scale functions

The scale functions wrap pixel values in the framework's scale variables, so custom CSS follows device density, Scale, and Text Scale exactly like framework CSS. Non-px and zero values pass through unchanged; lists are scaled item by item.

  • content-scaled($value): multiplies by --content-scale. Use for plugin content geometry.
  • ui-scaled($value): multiplies by --ui-scale, which includes device density. Use for framework-owned component geometry.
  • text-ui-scaled($value): multiplies by --text-ui-scale, which includes density, Scale, and Text Scale. Use for typography.
@use 'framework/mixins' as trmnl;

.forecast-tile {
    padding: trmnl.content-scaled(10px);
    // => padding: calc(10px * var(--content-scale, 1));
}
#

Public surface

framework/mixins forwards every module the framework compiles itself with, which is far more than it supports. Three families are public: their names and signatures hold from one release to the next, and the docs cover them page by page.

Everything else the module forwards is internal. That covers the selector helpers (scope-selector, generate-screen-utilities), the variant emitters (with-all-variants, generate-triple-variants), the factorized utility emitters, the pattern, border-level and text-paint helpers, and the trmnl-namespace wrapper. They exist to compile the framework's own classes and can change or disappear in any release, with no deprecation notice and no entry in the release notes.

The same split holds inside a public module: a member the docs do not name is internal even when it sits next to one they do. The device configuration is public and documented on Custom Devices ; the whole SCSS contract is summarized on Sass API .