0.1.0 • Published 4 years ago

vuepress-plugin-hero-pattern v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

Vuepress Plugin HeroPattern

Register a global <HeroPattern /> component for VuePress.

This component generate a seemless SVG background pattern.

This plugin is a adaptor of hero-pattern for VuePress

See Demo on CodeSandbox

Edit vuepress-plugin-hero-pattern

Installation

yarn add vuepress-plugin-hero-pattern -S
or
npm i vuepress-plugin-hero-pattern -S

Register the plugin

...
module.exports = {
  ...,
  plugins: {
    ['hero-pattern']
  },
  ...
}
...

Usage

Only background image, you must give the width & height of the element

<HeroPattern style="width: 240px; height: 80px;" />

With the custom slot, in the case, you can let the slot element control the pattern's height ÷

<hero-pattern>
  <div style="padding: 64px; font-size: 2rem; color: white;">
    All Posts
  </div>
</hero-pattern>

API

PropsDescriptionTypeDefault
pattern87 kinds of patterns that Hero Patterns supported, check pattern listStringline-to-motion
fillColorControls the foreground color of the generated image.String#9c92ac
fillOpacityControls the foreground opacity of the generated image.String0.4
backgroundColorControls the background color of the generated image.String#dfdbe5
repeatControls how the background repeated of the generated image.Stringrepeat

Slot

<HeroPattern /> component provide a custom slot, you can write some element on the generated pattern.

License

MIT @ xiaoluoboding