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