-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
shadows with with referenced color to support color modes
- Loading branch information
1 parent
56108a9
commit ae95e4c
Showing
16 changed files
with
200 additions
and
13 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
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
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
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
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,14 @@ | ||
import StyleDictionary from 'style-dictionary' | ||
import {TokenShadow} from '../../types/TokenShadow' | ||
|
||
export const shadowToCss: StyleDictionary.Transform = { | ||
type: `value`, | ||
transitive: true, | ||
matcher: (token: StyleDictionary.TransformedToken) => token.$type === 'shadow' && typeof token.value !== 'string', | ||
transformer: ({value}: {value: TokenShadow}) => { | ||
/* inset? | offset-x | offset-y | blur-radius | spread-radius | color */ | ||
return `${value.inset ? 'inset ' : ''}${value.x || 0} ${value.y || 0} ${value.blur || 0} ${value.spread || 0} ${ | ||
value.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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** | ||
* @description a css shadow | ||
* @format inset? | offset-x | offset-y | blur-radius? | spread-radius? | color? | ||
*/ | ||
type Shadow = string |
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,42 @@ | ||
{ | ||
"base": { | ||
"shadow": { | ||
"small": { | ||
"$value": { | ||
"color": "{color.shadow.small}", | ||
"x": "0px", | ||
"y": "1px", | ||
"blur": "0px" | ||
}, | ||
"$type": "shadow" | ||
}, | ||
"medium": { | ||
"$value": { | ||
"color": "{color.shadow.medium}", | ||
"x": "0px", | ||
"y": "3px", | ||
"blur": "6px" | ||
}, | ||
"$type": "shadow" | ||
}, | ||
"large": { | ||
"$value": { | ||
"color": "{color.shadow.large}", | ||
"x": "0px", | ||
"y": "8px", | ||
"blur": "24px" | ||
}, | ||
"$type": "shadow" | ||
}, | ||
"extraLarge": { | ||
"$value": { | ||
"color": "{color.shadow.extraLarge}", | ||
"x": "0px", | ||
"y": "12px", | ||
"blur": "28px" | ||
}, | ||
"$type": "shadow" | ||
} | ||
} | ||
} | ||
} |
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,36 @@ | ||
{ | ||
"color": { | ||
"shadow": { | ||
"small": { | ||
"$value": "{base.color.scale.black}", | ||
"alpha": 0.96, | ||
"$type": "color" | ||
}, | ||
"medium": { | ||
"$value": "{base.color.scale.gray.4}", | ||
"alpha": 0.85, | ||
"$type": "color" | ||
}, | ||
"large": { | ||
"$value": "{base.color.scale.gray.4}", | ||
"alpha": 0.8, | ||
"$type": "color" | ||
}, | ||
"extraLarge": { | ||
"$value": "{base.color.scale.gray.4}", | ||
"alpha": 0.7, | ||
"$type": "color" | ||
}, | ||
"highlight": { | ||
"$value": "{base.color.scale.white}", | ||
"alpha": 0.25, | ||
"$type": "color" | ||
}, | ||
"inset": { | ||
"$value": "{base.color.scale.gray.2}", | ||
"alpha": 0, | ||
"$type": "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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"shadow": { | ||
"small": { | ||
"$value": "{base.shadow.small}", | ||
"$type": "shadow" | ||
}, | ||
"medium": { | ||
"$value": "{base.shadow.medium}", | ||
"$type": "shadow" | ||
}, | ||
"large": { | ||
"$value": "{base.shadow.large}", | ||
"$type": "shadow" | ||
}, | ||
"extraLarge": { | ||
"$value": "{base.shadow.extraLarge}", | ||
"$type": "shadow" | ||
}, | ||
// "focus": { | ||
// "$value": { | ||
// "color": "{color.focus}", | ||
// "x": "0px", | ||
// "y": "0px", | ||
// "blur": "0px", | ||
// "spread": "3px" | ||
// }, | ||
// "$type": "shadow" | ||
// }, | ||
// "primer": { | ||
// "shadow": { | ||
// "highlight": { | ||
// "$value": { | ||
// "color": "{color.shadow.highlight}", | ||
// "x": "0px", | ||
// "y": "1px", | ||
// "blur": "0px", | ||
// "spread": "3px", | ||
// "inset": true | ||
// }, | ||
// "$type": "shadow" | ||
// }, | ||
// "inset": { | ||
// "$value": { | ||
// "color": "{color.shadow.inset}", | ||
// "x": "0px", | ||
// "y": "1px", | ||
// "blur": "0px", | ||
// "spread": "3px", | ||
// "inset": true | ||
// }, | ||
// "$type": "shadow" | ||
// }, | ||
// "focus": {"$value": "{shadow.focus}"} | ||
// } | ||
// } | ||
} | ||
} |
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,8 @@ | ||
export type TokenShadow = { | ||
color: string | ||
x: string | ||
y: string | ||
blur: string | ||
spread: string | ||
inset?: boolean | ||
} |