some initial work for user highlight v2
This commit is contained in:
parent
e7fe2dc9f9
commit
75f0c191dd
3 changed files with 13 additions and 4 deletions
|
@ -97,6 +97,15 @@ const alphaBlend = (fg, fga, bg) => {
|
|||
}, {})
|
||||
}
|
||||
|
||||
const invert = (rgb) => {
|
||||
return 'rgb'.split('').reduce((acc, c) => {
|
||||
console.log(rgb[c])
|
||||
acc[c] = 255 - rgb[c]
|
||||
console.log(acc[c])
|
||||
return acc
|
||||
}, {})
|
||||
}
|
||||
|
||||
const hex2rgb = (hex) => {
|
||||
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)
|
||||
return result ? {
|
||||
|
@ -125,6 +134,7 @@ export {
|
|||
rgb2hex,
|
||||
hex2rgb,
|
||||
mixrgb,
|
||||
invert,
|
||||
rgbstr2hex,
|
||||
getContrastRatio,
|
||||
alphaBlend
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue