Skip to content

Commit

Permalink
feat(theme): added utility CSS classes for all theme tokens for both …
Browse files Browse the repository at this point in the history
…`color` and `background-color` styles separately
  • Loading branch information
DRiFTy17 committed Oct 25, 2023
1 parent a4fb3bf commit 550ec32
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/lib/core/styles/theme/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@
}
}

///
/// Generates utility classes for each theme token as both `color` and `background-color` styles separately.
///
@mixin classes {
@each $token, $value in tokens.$tokens {
.#{config.$prefix}-color--#{$token} {
color: #{variable($token)};
}
.#{config.$prefix}-background--#{$token} {
background-color: #{variable($token)};
}
}
}

///
/// Gets a CSS custom property declaration for a specific theme token, with its token value as the fallback value
///
Expand Down
3 changes: 3 additions & 0 deletions src/lib/theme/forge-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@
* {
@include scrollbar.base;
}

// Utility classes for all theme tokens
@include theme.classes;

0 comments on commit 550ec32

Please sign in to comment.