0.2.0 • Published 1 year ago

pixel-perfect-storybook-addon v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Storybook Addon Pixel Perfect

Build pixel perfect components by adding an overlaying image of component in Storybook's preview iframe.

Live example. Try to toggle eye button in the Storybook toolbar and "Pixel Perfect" panel.

Features

  • Overlay rendering.
  • Overlay visibility toggling.
  • Overlay opacity customization.
  • Overlay color inversion toggling.
  • Overlay options resetting.

Usage

In parameters of your stories:

parameters: {
    pixelPerfect: {
        overlay: {
            src: "path/to/overlay",
            opacity: 0.5,
            colorInversion: true,
        },
    },
},

Options

NameTypeDefaultDescription
overlay.srcstringPath to the overlay image. This can be any string that the src attribute of the HTML img element accepts.
overlay.opacitynumber0.5Opacity of the overlay.
overlay.colorInversionbooleantrueIf true colors of the overlay are inverted. The effect is the same as using the CSS filter property with the value invert(1).