-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[framer] Support Framer color tokens for ThemeProvider (#19451)
- Loading branch information
Showing
7 changed files
with
175 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const colorTokenRegex = /var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/; | ||
|
||
/** | ||
* Checks if the color string is a Framer Shared Color token and extracts | ||
* the underlying color or returns the original string. | ||
* | ||
* @param {string} color - A Framer Shared Color Token/regular CSS color | ||
* @return {string} A valid HTML color string | ||
* | ||
* @example | ||
* console.log(parseColor('var(--token-73eaaa94-88d1-416e-9e22-e09837612534, rgb(0, 0, 0))')); // rgb(0, 0, 0) | ||
* | ||
*/ | ||
export function parseColor(color: string): string { | ||
const colorToken = color.match(colorTokenRegex); | ||
|
||
return colorToken ? colorToken[2] : color; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
{ | ||
"name": "@framer/material-ui.material-ui", | ||
"author": "Material-UI Team", | ||
"description": "Material-UI Framer components", | ||
"version": "1.0.0", | ||
"main": "dist/index.js", | ||
"license": "MIT", | ||
"homepage": "http://material-ui.com/", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/mui-org/material-ui.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/mui-org/material-ui/issues" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^16.8" | ||
}, | ||
"dependencies": { | ||
"@material-ui/core": "^4.5.0", | ||
"@material-ui/icons": "^4.4.0", | ||
"naming-style": "^1.0.0" | ||
}, | ||
"peerDependencies": { | ||
"framer": "^1.0.0", | ||
"react": "^16.8.0" | ||
}, | ||
"framer": { | ||
"displayName": "Material-UI", | ||
"id": "ee255265-d0d6-4999-a685-9461c1248b6a" | ||
} | ||
"name": "@framer/material-ui.material-ui", | ||
"author": "Material-UI Team", | ||
"description": "Material-UI Framer components", | ||
"version": "1.0.0", | ||
"main": "dist/index.js", | ||
"license": "MIT", | ||
"homepage": "http://material-ui.com/", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/mui-org/material-ui.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/mui-org/material-ui/issues" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^16.8" | ||
}, | ||
"dependencies": { | ||
"@material-ui/core": "^4.9.0", | ||
"@material-ui/icons": "^4.5.1", | ||
"naming-style": "^1.0.0" | ||
}, | ||
"peerDependencies": { | ||
"framer": "^1.0.0", | ||
"react": "^16.8.0" | ||
}, | ||
"framer": { | ||
"displayName": "Material-UI", | ||
"id": "ee255265-d0d6-4999-a685-9461c1248b6a" | ||
} | ||
} |
Oops, something went wrong.