Theemo / @theemo/style-dictionary / makeConstrainedFilter
Function: makeConstrainedFilter()
ts
function makeConstrainedFilter(constraints): (token) => booleanCreates a function to filter tokens on the given constraints.
Parameters
| Parameter | Type | Description |
|---|---|---|
constraints | Partial<FeatureConstraints & ScopeConstraint> | the constraints |
Returns
Function
a filter function
Parameters
| Parameter | Type |
|---|---|
token | TransformedToken |
Returns
boolean
Example
Use as filter property in style dictionary config.
js
const { makeConstrainedFilter } = require('@theemo/style-dictionary');
module.exports = {
platforms: {
'[your-platforn]': {
filter: makeConstrainedFilter({
features: {
'color-scheme': 'dark'
}
})
}
}
}