Skip to content

Commit

Permalink
Add CSS vars for main theme colors
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Conway-Jones committed May 29, 2019
1 parent 02c7c46 commit 95fab7a
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
### 2.15.4: Maintenance Release

**Enhancements**

- Add CSS variable names for main theme colours to make user customisations easier

**Fixes**

- Re-fix switch to not visibly switch when set to show input not output. Issue #506
Expand Down
11 changes: 11 additions & 0 deletions README.md
Expand Up @@ -91,6 +91,17 @@ The widget layout is managed by a `dashboard` tab in the sidebar of the Node-RED

You can also choose to use the basic Angular Material themes instead if you like, either just within any ui_templates or for the whole Dashboard. This will only affect angular components so some of the charts and so on may need extra work.

**Note**: For users creating their own templates the following CSS variable names are available
to help pick up the theme colours.

- --nr-dashboard-pageBackgroundColor
- --nr-dashboard-pageTitlebarBackgroundColor
- --nr-dashboard-groupBackgroundColor
- --nr-dashboard-groupTextColor
- --nr-dashboard-groupBorderColor
- --nr-dashboard-widgetBackgroundColor
- --nr-dashboard-widgetTextColor
- --nr-dashboard-widgetBorderColor

#### Widgets

Expand Down
12 changes: 12 additions & 0 deletions dist/css/app.min.less
Expand Up @@ -159,6 +159,18 @@ md-card {
@nrTemplateTheme: true;
@nrUnitHeight: 24px;

// define some CSS variables for user usage
:root {
--nr-dashboard-pageBackgroundColor: @pageBackgroundColor;
--nr-dashboard-pageTitlebarBackgroundColor: @pageTitlebarBackgroundColor;
--nr-dashboard-groupTextColor: @groupTextColor;
--nr-dashboard-groupBackgroundColor: @groupBackgroundColor;
--nr-dashboard-groupBorderColor: @groupBorderColor;
--nr-dashboard-widgetTextColor: @widgetTextColor;
--nr-dashboard-widgetBackgroundColor: @widgetBackgroundColor;
--nr-dashboard-widgetBorderColor: @widgetBorderColor;
}

.nr-dashboard-disabled {
opacity: 0.4 !important;
pointer-events: none !important;
Expand Down
2 changes: 1 addition & 1 deletion dist/dashboard.appcache
Expand Up @@ -18,4 +18,4 @@ fonts/weather-icons-lite.woff2
NETWORK:
*

# hash: dca0f1f8c88cd55ba9e5b3d9a5f5e6eab9e757d3d188d1f54e6e8ab313294a45
# hash: 751207d6725e85268127de80b5aaeb96d9240ab8ad45cf52445576471c9a19fb
12 changes: 12 additions & 0 deletions src/theme.less
Expand Up @@ -15,6 +15,18 @@
@nrTemplateTheme: true;
@nrUnitHeight: 24px;

// define some CSS variables for user usage
:root {
--nr-dashboard-pageBackgroundColor: @pageBackgroundColor;
--nr-dashboard-pageTitlebarBackgroundColor: @pageTitlebarBackgroundColor;
--nr-dashboard-groupTextColor: @groupTextColor;
--nr-dashboard-groupBackgroundColor: @groupBackgroundColor;
--nr-dashboard-groupBorderColor: @groupBorderColor;
--nr-dashboard-widgetTextColor: @widgetTextColor;
--nr-dashboard-widgetBackgroundColor: @widgetBackgroundColor;
--nr-dashboard-widgetBorderColor: @widgetBorderColor;
}

.nr-dashboard-disabled {
opacity: 0.4 !important;
pointer-events: none !important;
Expand Down

0 comments on commit 95fab7a

Please sign in to comment.