UNPKG

881 BJavaScriptView Raw
1/**
2 * Define theme "g".
3 * @function g
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 g */
16function g (width, height, color1, color2) {
17 let r = numcal.min(height, width)
18
19 return _svg(width, height, {
20 rect: [
21 {
22 '@': {
23 x: 0,
24 y: 0,
25 rx: r,
26 ry: r,
27 width: width,
28 height: height,
29 fill: color2
30 }
31 },
32 {
33 '@': {
34 x: 0,
35 y: 0,
36 rx: r,
37 ry: r,
38 width: width,
39 height: height,
40 fill: color1
41 }
42 }
43 ]
44
45 })
46}
47
48g.$reversed = false
49
50module.exports = g