Skip to content

Commit

Permalink
using color-mix
Browse files Browse the repository at this point in the history
* using color-mix

* remove colord
  • Loading branch information
canoypa authored Dec 18, 2023
1 parent 71b5522 commit 630af78
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"@types/node": "^20.9.5",
"@types/react": "^18.2.38",
"@types/react-dom": "^18.2.17",
"colord": "^2.9.3",
"eslint": "^8.54.0",
"eslint-config-next": "^14.0.3",
"pandacss-preset-material-tokens": "^0.1.1",
Expand Down
11 changes: 4 additions & 7 deletions panda.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { defineConfig } from '@pandacss/dev'
import { colord } from 'colord'
import { presetMaterialTokens } from 'pandacss-preset-material-tokens'

export default defineConfig({
Expand Down Expand Up @@ -72,14 +71,12 @@ export default defineConfig({
const opacityToken = token.raw(`opacity.${opacity}`)?.value ?? opacity

const colorValue = colorToken
const opacityValue = !isNaN(Number(opacityToken))
? Number(opacityToken)
: 1
const opacityValue =
(!isNaN(Number(opacityToken)) ? Number(opacityToken) : 1) * 100

return {
backgroundColor: colord(colorValue)
.alpha(opacityValue)
.toRgbString(),
// srgb がなにかわかってない
backgroundColor: `color-mix(in srgb, ${colorValue} ${opacityValue}%, transparent)`,
}
},
},
Expand Down
7 changes: 0 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 630af78

Please sign in to comment.