1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | 'use strict'
|
11 |
|
12 | const _svg = require('./_svg')
|
13 | const numcal = require('numcal')
|
14 |
|
15 |
|
16 | function h (width, height, color1, color2) {
|
17 | let r = numcal.min(height, width)
|
18 | let lineWidth = numcal.min(width, height) * 0.05
|
19 |
|
20 | return _svg(width, height, {
|
21 | rect: [
|
22 | {
|
23 | '@': {
|
24 | x: 0,
|
25 | y: 0,
|
26 | rx: r,
|
27 | ry: r,
|
28 | width: width,
|
29 | height: height,
|
30 | fill: color2
|
31 | }
|
32 | },
|
33 | {
|
34 | '@': {
|
35 | x: lineWidth / 2,
|
36 | y: lineWidth / 2,
|
37 | rx: r,
|
38 | ry: r,
|
39 | width: width - lineWidth,
|
40 | height: height - lineWidth,
|
41 | fill: 'none',
|
42 | 'stroke-width': lineWidth,
|
43 | stroke: color1
|
44 | }
|
45 | },
|
46 | {
|
47 | '@': {
|
48 | x: lineWidth * 2,
|
49 | y: lineWidth * 2,
|
50 | rx: r,
|
51 | ry: r,
|
52 | width: width - lineWidth * 4,
|
53 | height: height - lineWidth * 4,
|
54 | fill: color1
|
55 | }
|
56 | }
|
57 | ]
|
58 | })
|
59 | }
|
60 |
|
61 | h.$reversed = false
|
62 |
|
63 | module.exports = h
|