From 973fe5227537ebddaa009b312a8a774091d5b327 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 8 Oct 2021 16:45:21 +0200 Subject: [PATCH] lighter node style of note map in dark theme --- src/public/app/widgets/note_map.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/public/app/widgets/note_map.js b/src/public/app/widgets/note_map.js index 46dff3cbd..3f5d7bbe6 100644 --- a/src/public/app/widgets/note_map.js +++ b/src/public/app/widgets/note_map.js @@ -153,23 +153,22 @@ export default class NoteMapWidget extends NoteContextAwareWidget { } stringToColor(str) { + if (this.themeStyle === "dark") { + str = "0" + str; // magic lightening modifier + } + let hash = 0; for (let i = 0; i < str.length; i++) { hash = str.charCodeAt(i) + ((hash << 5) - hash); } - let colour = '#'; + + let color = '#'; for (let i = 0; i < 3; i++) { - let value = (hash >> (i * 8)) & 0xFF; + const 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); + color += ('00' + value.toString(16)).substr(-2); } - return colour; + return color; } rgb2hex(rgb) {