Skip to content

Commit

Permalink
fix: theme-tools methods color mix amounts (#7158)
Browse files Browse the repository at this point in the history
Closes #7155
  • Loading branch information
anubra266 committed Dec 28, 2022
1 parent 30938fa commit be1926e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/chatty-games-refuse.md
@@ -0,0 +1,5 @@
---
"@chakra-ui/theme-tools": patch
---

Resolve theme tools to values between 0 and 1
6 changes: 3 additions & 3 deletions packages/components/theme-tools/src/color.ts
Expand Up @@ -106,7 +106,7 @@ export const whiten = (color: string, amount: number) => (theme: Dict) => {
*/
export const blacken = (color: string, amount: number) => (theme: Dict) => {
const raw = getColor(theme, color)
return toHex(mix(raw, "#000", amount))
return toHex(mix(raw, "#000", amount / 100))
}

/**
Expand All @@ -118,7 +118,7 @@ export const blacken = (color: string, amount: number) => (theme: Dict) => {
*/
export const darken = (color: string, amount: number) => (theme: Dict) => {
const raw = getColor(theme, color)
return toHex(reduceLightness(raw, amount))
return toHex(reduceLightness(raw, amount / 100))
}

/**
Expand All @@ -130,7 +130,7 @@ export const darken = (color: string, amount: number) => (theme: Dict) => {
*/
export const lighten = (color: string, amount: number) => (theme: Dict) => {
const raw = getColor(theme, color)
toHex(increaseLightness(raw, amount))
toHex(increaseLightness(raw, amount / 100))
}

/**
Expand Down

1 comment on commit be1926e

@vercel
Copy link

@vercel vercel bot commented on be1926e Dec 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.