forked from node-red-contrib-themes/theme-collection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
themes.js
25 lines (20 loc) · 794 Bytes
/
themes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const path = require('path')
const fs = require('fs')
const package = require('./package.json')
const rootDir = path.resolve(__dirname)
module.exports = function (RED) {
const themes = fs.readdirSync(`${rootDir}/themes`)
for (const themeName of themes) {
const themePath = `themes/${themeName}`
RED.plugins.registerPlugin(
themeName,
{
type: 'node-red-theme',
css: [`${themePath}/${themeName}.min.css`],
mermaid: { theme: require(`./${themePath}/${themeName}-mermaid.min.json`) },
monacoOptions: { theme: require(`./${themePath}/${themeName}-monaco.min.json`) }
}
)
}
RED.log.info(`Node-RED Contrib Theme Collection version: v${package.version}`)
}