Skip to content

Commit 09b2eeb

Browse files
committed
chore: release v0.1.2
1 parent df588a0 commit 09b2eeb

File tree

5 files changed

+47
-14
lines changed

5 files changed

+47
-14
lines changed

β€ŽGeoPattern.vueβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
<script>
88
import gp from 'geopattern'
99
10+
const PLUGIN_NAME = 'vuepress-plugin-geopattern'
11+
1012
export default {
1113
name: 'GeoPattern',
1214
props: {
15+
// Will be used as the seed for generation
16+
seed: { type: String, default: () => PLUGIN_NAME + new Date().toString() },
1317
// Given array elements is hexadecimal color value [0-F]
1418
colorHexs: { type: Array, default: () => ['3', '9', 'C'] },
1519
// Controls the relative background color of the generated image.
1620
baseColor: { type: String, default: '#933c3c' }
1721
},
1822
computed: {
19-
// Will be used as the seed for generation
20-
seed () {
21-
return this.$page && this.$page.title + new Date().toString()
22-
},
2323
style () {
2424
return {
2525
'background-image': this.getPattern()

β€ŽREADME.mdβ€Ž

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
1-
# Vuepress Plugin GeoPattern
1+
# VuePress Plugin GeoPattern
2+
3+
<p align="left">
4+
<a href="https://www.npmjs.com/package/vuepress-plugin-geopattern"><img src="https://img.shields.io/npm/v/vuepress-plugin-geopattern.svg?maxAge=2592000"></a>
5+
<a href="https://www.npmjs.com/package/vuepress-plugin-geopattern"><img src="https://img.shields.io/npm/dt/vuepress-plugin-geopattern.svg"></a>
6+
<a href="https://raw.githubusercontent.com/vueblocks/vuepress-plugin-geopattern/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
7+
</p>
28

39
Register a global `<GeoPattern />` component for VuePress.
410

511
This component generate a beautiful random geometric pattern & random color background images from a string you given.
612

7-
> This plugin is a adapter of [geopattern](https://github.com/btmills/geopattern)
13+
> This plugin is a adapter of [geopattern](https://github.com/btmills/geopattern) for VuePress
814
915
## See Demo on CodeSandbox
1016

11-
[![Edit vuepress-plugin-geopattern](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/musing-surf-twidv?fontsize=14&hidenavigation=1&theme=dark)
17+
[![Edit vuepress-plugin-geopattern](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/vuepress-plugin-geopattern-twidv?fontsize=14&hidenavigation=1&theme=dark)
1218

1319
## Installation
1420

1521
```bash
1622
yarn add vuepress-plugin-geopattern -S
1723
or
18-
npm i vuepress-plugin-disqus -S
24+
npm i vuepress-plugin-geopattern -S
1925
```
2026

2127
## Register the plugin
@@ -34,13 +40,33 @@ module.exports = {
3440

3541
## Usage
3642

43+
### Default
44+
3745
> Only background image, you must give the height of the element
3846
3947
```vue
40-
<GeoPattern style="height: 80px;" />
48+
<GeoPattern style="height: 160px;" />
49+
```
50+
51+
### Custom pattern
52+
53+
If you don't provide a seed, the pattern's seed is random.
54+
55+
In VuePress you can use [global computed properties](https://vuepress.vuejs.org/guide/global-computed.html) such as use `this.$page.title` as a seed, generate a geopattern by the page title.
56+
57+
Each page title is different, so you got difference geopattern.
58+
59+
```vue
60+
<GeoPattern
61+
style="height: 160px;"
62+
seed="$page.title"
63+
:colorHexs="['F', '4', 'A']"
64+
/>
4165
```
4266

43-
> With the custom slot, in the case, you can let the slot element control the pattern's height
67+
### With the custom slot
68+
69+
> In the case, you can let the slot element control the pattern's height
4470
4571
```vue
4672
<geo-pattern>
@@ -56,13 +82,18 @@ module.exports = {
5682
5783
| Props | Description | Type | Default |
5884
| :---: | :---------: | :--: | :-----: |
59-
| colorHexs | Given array elements is hexadecimal color value [0-F] | Array | `['3', '9' 'C' ]` |
85+
| seed | Will be used as the seed for generation | String | `vuepress-plugin-geopattern` |
86+
| colorHexs | Given array elements is hexadecimal color value [0-F] | Array | `['3', '9', 'C' ]` |
6087
| baseColor | Controls the relative background color of the generated image. | String | `933c3c` |
6188

6289
## Slot
6390

6491
`<GeoPattern />` component provide a custom slot, you can write some element on the generated pattern.
6592

93+
## Related VuePress Plugin
94+
95+
* [vuepress-plugin-hero-pattern](https://github.com/xiaoluoboding/vuepress-plugin-hero-pattern) - Hero Patterns is a set of repeatable, seemless SVG background patterns
96+
6697
## License
6798

68-
MIT
99+
MIT @ [xiaoluoboding](https://github.com/xiaoluoboding)
File renamed without changes.

β€Žindex.jsβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
const path = require('path')
22

33
module.exports = {
4+
name: 'geopattern',
5+
46
enhanceAppFiles: [
5-
path.resolve(__dirname, 'enhanceAppFile.js')
7+
path.resolve(__dirname, 'enhanceApp.js')
68
],
79

810
chainWebpack (config, isServer) {

β€Žpackage.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vuepress-plugin-geopattern",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"description": "Generate beautiful random geometric pattern background images.",
55
"main": "index.js",
66
"repository": {

0 commit comments

Comments
Β (0)