Skip to content
SnapDOMGitHub★ 8K
@zumer/snapdom-plugins · MIT

Tint the capture with a color.

Tints an HTML capture with a mix-blend-mode overlay. Opacity 0 leaves it unchanged.

npm install @zumer/snapdom@latest @zumer/snapdom-plugins@latest

Usage

import { snapdom } from '@zumer/snapdom';
import { colorTint } from '@zumer/snapdom-plugins/color-tint';

const el = document.querySelector('#target');
const result = await snapdom(el, { plugins: [colorTint({ color: 'royalblue', opacity: 0.4 })] });
const image = await result.toPng();
document.body.append(image);

Options

OptionTypeDefaultDescription
colorstring'red'Any CSS color value
opacitynumber1Overlay opacity (0–1)
Try it here

Live element

Component preview
Capture an editable component
1,284+12% vs last week

Editable text and an open shadow root can be captured together.

Result

Nothing captured yet

Edit the title, then run. This uses the real library from unpkg.