Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
@six7/figma-tokens-helpers
Advanced tools
Exposes functions that utilize Figma Tokens shared plugin data.
Import the functions you need into your plugin.
Returns all tokens stored on document as an object containing token sets that each contain tokens as an array.
Caution: These tokens are unresolved meaning they could use aliases. To get the resolved value according to what token sets were used, see getResolvedTokens
Example usage:
getTokensStoredOnDocument()
Result:
{
"global": {
[
{name: 'colors.white', value: '#ffffff', type: 'color'},
{name: 'fg.default', value: '{colors.white}', type: 'color'}
]
}
}
Reads all tokens stored on the document and the last used token sets and returns an array of tokens with their resolved value according to the set combination.
getResolvedTokens()
Result:
[
{name: 'colors.white', value: '#ffffff', type: 'color', internal__Parent: '_scale/light', rawValue: '#ffffff'}, {name: 'bg.default', value: '#ffffff', type: 'color', internal__Parent: 'light/default', rawValue: '{colors.white}'}
]
Returns the used token sets in the document as they were last used, e.g. if a set was toggled active/set as source or disabled. This has an impact on what values each token has.
getUsedTokenSetsOnDocument()
Result:
{
'global': 'source', 'light': 'disabled', 'dark': 'enbabled'
}
Returns all tokens stored on a node.
getTokensOnNode(figma.currentPage.selection[0])
Result:
{
"fill": "colors.black",
"sizing": "sizing.md"
}
Returns the stored token on a node for a given key
getTokensByKey(figma.currentPage.selection[0], "fill")
Result:
"colors.black"
Merges given tokens with given token sets. This function is being used in getResolvedTokens, but with this function you can feed it custom sets or tokens.
mergeTokens(tokens, sets)
Result:
[
{name: 'colors.white', value: '#ffffff', type: 'color', internal__Parent: '_scale/light', rawValue: '#ffffff'}, {name: 'bg.default', value: '#ffffff', type: 'color', internal__Parent: 'light/default', rawValue: '{colors.white}'}
]
FAQs
Helper functions for using Figma Tokens data
The npm package @six7/figma-tokens-helpers receives a total of 0 weekly downloads. As such, @six7/figma-tokens-helpers popularity was classified as not popular.
We found that @six7/figma-tokens-helpers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.