Last active
June 22, 2024 18:41
-
-
Save Pagebakers/b02e52dc5bfa6d22fd1f0f5e89aa2ab9 to your computer and use it in GitHub Desktop.
Revisions
-
Pagebakers revised this gist
Jan 29, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ import { ThemeTypings } from '@chakra-ui/react' /** * Transparentize Chakra UI color tokens -
Pagebakers created this gist
Jan 29, 2024 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ import { ThemeTypings } from '@chakra-ui/styled-system' /** * Transparentize Chakra UI color tokens * @param color - Chakra UI (semantic) token * @param opacity - Opacity value 0 to 1. */ export const alpha = (color: ThemeTypings['colors'], value: number) => { const key = color.replaceAll('.', '-') return `color-mix(in srgb, var(--chakra-colors-${key}) ${Math.max(Math.min(value * 100, 100), 0)}%, transparent)` }