Skip to content

Commit d802386

Browse files
committed
fix(hooks/svg-filters) Use 0 as base value for lightness
1 parent 51eca9e commit d802386

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/components/svg-filters.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ const NumberOrString = PropTypes.oneOfType([PropTypes.string, PropTypes.number])
77
/**
88
* ColorCorrection :: Props -> React.Element
99
*/
10-
const ColorCorrection = ({ lightness = 0, opacity = 0.5 }) =>
11-
<feColorMatrix values={`1 0 0 0 ${lightness} 0 1 0 0 ${lightness} 0 0 1 0 ${lightness} 0 0 0 ${opacity} 0`} />
10+
const ColorCorrection = ({ lightness: relativeLightness = 1, opacity = 0.5 }) => {
11+
12+
const lightness = 1 * (1 - relativeLightness)
13+
14+
return <feColorMatrix values={`1 0 0 0 ${lightness} 0 1 0 0 ${lightness} 0 0 1 0 ${lightness} 0 0 0 ${opacity} 0`} />
15+
}
1216

1317
ColorCorrection.propTypes = {
1418
lightness: NumberOrString,

0 commit comments

Comments
 (0)