Skip to content

Commit

Permalink
Make ui-table use IsDark
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Conway-Jones committed Dec 4, 2020
1 parent bbff5b1 commit 983068c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions node-red-node-ui-table/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ module.exports = function (RED) {
if (checkConfig(node, config)) {
var ui = RED.require('node-red-dashboard')(RED);
var sizes = ui.getSizes();
var luma = 255;
if (ui.hasOwnProperty("getTheme") && (ui.getTheme() !== undefined)) {
var rgb = parseInt(ui.getTheme()["page-sidebar-backgroundColor"].value.substring(1), 16); // convert rrggbb to decimal
luma = 0.2126 * ((rgb >> 16) & 0xff) + 0.7152 * ((rgb >> 8) & 0xff) + 0.0722 * ((rgb >> 0) & 0xff); // per ITU-R BT.709
}
var html = HTML(config,(luma < 128));
// var luma = 255;
// if (ui.hasOwnProperty("getTheme") && (ui.getTheme() !== undefined)) {
// var rgb = parseInt(ui.getTheme()["page-sidebar-backgroundColor"].value.substring(1), 16); // convert rrggbb to decimal
// luma = 0.2126 * ((rgb >> 16) & 0xff) + 0.7152 * ((rgb >> 8) & 0xff) + 0.0722 * ((rgb >> 0) & 0xff); // per ITU-R BT.709
// }
var html = HTML(config,ui.isDark());

done = ui.addWidget({
node: node,
Expand Down
4 changes: 2 additions & 2 deletions node-red-node-ui-table/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-red-node-ui-table",
"version": "0.3.9",
"version": "0.3.10",
"description": "Table UI widget node for Node-RED Dashboard",
"author": "Kazuhito Yokoi",
"contributors": ["Dave Conway-Jones","@hotNipi","@Christian-Me"],
Expand All @@ -11,7 +11,7 @@
}
},
"peerDependencies": {
"node-red-dashboard": ">2.15.0"
"node-red-dashboard": ">2.16.0"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 983068c

Please sign in to comment.