mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-06-17 02:29:10 +00:00
[design]: add color lib and helpers
This commit is contained in:
parent
6ba0b0b62b
commit
33dd324708
2 changed files with 18 additions and 0 deletions
16
packages/roleypoly-design/src/helpers/colors.ts
Normal file
16
packages/roleypoly-design/src/helpers/colors.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import * as Color from 'color'
|
||||
|
||||
const color = (i: Color | string) => {
|
||||
return new Color(i)
|
||||
}
|
||||
|
||||
export const stepUp = (input: Color | string): string => {
|
||||
return color(input).lighten(0.1).string()
|
||||
}
|
||||
export const stepDown = (input: Color | string): string => {
|
||||
return color(input).darken(0.1).string()
|
||||
}
|
||||
|
||||
export const textMode = (bg: Color | string, light: string = '#efefef', dark: string = '#1c1111'): string => {
|
||||
return color(bg).isDark() ? light : dark
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue