generated from codesandbox/codesandbox-template-blank
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(button plugin): fixed button plugin for clear and outline styles …
…to be compatable for dark mode
- Loading branch information
1 parent
07dcc3f
commit c94c789
Showing
4 changed files
with
49 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** @type {import('tinycolor2')} */ | ||
const tinycolor = require('../lib/tinycolor'); | ||
|
||
const generateTransparentTxtBg = ({ color, alpha }) => { | ||
const { h, s, v } = tinycolor(color).toHsv(); | ||
const lightColor = tinycolor({ h, s, v: s > 0.25 ? 0.55 : 0.4 }) | ||
.setAlpha(alpha || 1) | ||
.toRgbString(); | ||
const darkColorHSV = tinycolor({ h, s, v: v * 0.8 }).toRgbString(); | ||
const darkColorHSL = tinycolor(darkColorHSV).toHsl(); | ||
const darkColor = tinycolor({ | ||
h: darkColorHSL.h, | ||
s: darkColorHSL.s, | ||
l: 0.8, | ||
}).toRgbString(); | ||
return { | ||
lightColor, | ||
darkColor, | ||
} | ||
} | ||
module.exports = { generateTransparentTxtBg }; |