UNPKG

949 BJavaScriptView Raw
1/**
2 * Define theme "c". Rect with border.
3 * @function c
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 c */
16function c (width, height, color1, color2) {
17 let lineWidth = numcal.min(width, height) * 0.05
18
19 return _svg(width, height, {
20 rect: [
21 {
22 '@': {
23 x: 0,
24 y: 0,
25 width: width,
26 height: height,
27 fill: color2
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}
43
44c.$reversed = true
45
46module.exports = c