UNPKG

1.09 kBJavaScriptView Raw
1/**
2 * Define theme "f".
3 * @function f
4 * @param {number} width - Image width
5 * @param {number} height - Image height
6 * @param {string} color1 - Shape color 1.
7 * @param {string} color2 - Shape color 2.
8 * @returns {string} - SVG string.
9 */
10'use strict'
11
12const _svg = require('./_svg')
13const numcal = require('numcal')
14
15/** @lends f */
16function f (width, height, color1, color2) {
17 let lineWidth = numcal.min(width, height) * 0.05
18 let r = numcal.min(height, width) * 0.2
19
20 return _svg(width, height, {
21 rect: [
22 {
23 '@': {
24 x: lineWidth / 2,
25 y: lineWidth / 2,
26 width: width - lineWidth,
27 height: height - lineWidth,
28 rx: r,
29 ry: r,
30 fill: color2
31 }
32 },
33 {
34 '@': {
35 x: lineWidth / 2,
36 y: lineWidth / 2,
37 width: width - lineWidth,
38 height: height - lineWidth,
39 rx: r,
40 ry: r,
41 fill: 'none',
42 'stroke-width': lineWidth,
43 stroke: color1
44 }
45 }
46 ]
47 })
48}
49
50f.$reversed = true
51
52module.exports = f