Skip to content
This repository was archived by the owner on Jun 9, 2025. It is now read-only.
This repository was archived by the owner on Jun 9, 2025. It is now read-only.

Possible to use math in tokens?  #186

Description

@bradfrost

Hi there!
I'm setting up Theo for my project and know that it's possible to reference other token names, which is great! I was wondering if it's possible to apply math functions to tokens.

I currently have a general sizing Sass variable that we're hoping to extract into tokens:

$size-base-unit: 0.5rem; // = 8px

We then use that size unit for our typography sizing and spacing, like so:

$font-size-xxs: size(1.25); // 10px
$font-size-sm: size(1.5); // 12px
$font-size-med: size(2); // 16px
$font-size-large: size(3); // 24px
$font-size-xl: size(5); // 40px

The gist is that altering the base size unit will affect the typography and spacing systems, which is pretty neat.

Is it possible to do this type of thing at the token level? Or do those font size token values need hard coded?

Thanks very much!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions