From cdf127c7f1fbd4493c598702c7889ea7246eb8fc Mon Sep 17 00:00:00 2001 From: Amio Date: Sat, 23 Jun 2018 01:42:12 +0800 Subject: [PATCH] Add color presets --- lib/color-presets.js | 11 +++++++++++ lib/index.js | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 lib/color-presets.js diff --git a/lib/color-presets.js b/lib/color-presets.js new file mode 100644 index 0000000..4fd519f --- /dev/null +++ b/lib/color-presets.js @@ -0,0 +1,11 @@ +module.exports = { + green: '3C1', + blue: '08C', + red: 'D52', + yellow: 'DB1', + orange: 'F73', + purple: 'A3E', + pink: 'E48', + grey: '999', + black: '000' +} diff --git a/lib/index.js b/lib/index.js index 42c8198..f9ff75a 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,6 +1,9 @@ const calcWidth = require('./calc-text-width.js').Arial12 +const colorPresets = require('./color-presets.js') + +module.exports = function ({subject, status, color}) { + color = colorPresets[color] || color || colorPresets['green'] -module.exports = function ({subject, status, color = '3C1'}) { // const charWidth = 7.3 const calcFactor = 0.4