@antv/x6-next
Version:
JavaScript diagramming library that uses SVG and HTML for rendering.
26 lines (23 loc) • 640 B
text/typescript
import { getNumber } from './util'
export interface BrightnessArgs {
/**
* The proportion of the conversion.
* A value of `1` leaves the input unchanged.
* A value of `0` will create an image that is completely black.
*
* Default `1`.
*/
amount?: number
}
export function brightness(args: BrightnessArgs = {}) {
const amount = getNumber(args.amount, 1)
return `
<filter>
<feComponentTransfer>
<feFuncR type="linear" slope="${amount}"/>
<feFuncG type="linear" slope="${amount}"/>
<feFuncB type="linear" slope="${amount}"/>
</feComponentTransfer>
</filter>
`.trim()
}