From 5938e033d4f38fc8b166f4b87eba166dc390ac64 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 8 Oct 2021 16:38:37 +0200 Subject: [PATCH] lighter node style of note map in dark theme --- src/public/app/widgets/note_map.js | 12 +++++++++++- src/public/stylesheets/theme-dark.css | 2 ++ src/public/stylesheets/theme-light.css | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/public/app/widgets/note_map.js b/src/public/app/widgets/note_map.js index bd7f7d1a8..46dff3cbd 100644 --- a/src/public/app/widgets/note_map.js +++ b/src/public/app/widgets/note_map.js @@ -45,6 +45,9 @@ export default class NoteMapWidget extends NoteContextAwareWidget { doRender() { this.$widget = $(TPL); + const documentStyle = window.getComputedStyle(document.documentElement); + this.themeStyle = documentStyle.getPropertyValue('--theme-style')?.trim(); + this.$container = this.$widget.find(".note-map-container"); this.$styleResolver = this.$widget.find('.style-resolver'); @@ -156,7 +159,14 @@ export default class NoteMapWidget extends NoteContextAwareWidget { } let colour = '#'; for (let i = 0; i < 3; i++) { - const value = (hash >> (i * 8)) & 0xFF; + let value = (hash >> (i * 8)) & 0xFF; + + console.log("this.themeStyle", this.themeStyle); + + if (this.themeStyle === "dark" && value < 128) { + value += 128; // lighten up the colors + } + colour += ('00' + value.toString(16)).substr(-2); } return colour; diff --git a/src/public/stylesheets/theme-dark.css b/src/public/stylesheets/theme-dark.css index 37ba57006..3c6009b63 100644 --- a/src/public/stylesheets/theme-dark.css +++ b/src/public/stylesheets/theme-dark.css @@ -1,4 +1,6 @@ :root { + --theme-style: dark; + --main-font-family: MontserratLight; --main-font-size: normal; diff --git a/src/public/stylesheets/theme-light.css b/src/public/stylesheets/theme-light.css index 612ef9f0f..246dacad6 100644 --- a/src/public/stylesheets/theme-light.css +++ b/src/public/stylesheets/theme-light.css @@ -2,6 +2,9 @@ value from this theme will be used. For this reason this theme uses "html" instead of ":root" since it's less "specific" and thus serves as default */ html { + /* either light or dark, colored theme with darker tones are also dark, used e.g. for note map node colors */ + --theme-style: light; + --main-font-family: MontserratLight; --main-font-size: normal;