mirror of
https://github.com/zadam/trilium.git
synced 2025-01-15 19:51:57 +08:00
lighter node style of note map in dark theme
This commit is contained in:
parent
5938e033d4
commit
973fe52275
1 changed files with 9 additions and 10 deletions
|
@ -153,23 +153,22 @@ export default class NoteMapWidget extends NoteContextAwareWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
stringToColor(str) {
|
stringToColor(str) {
|
||||||
|
if (this.themeStyle === "dark") {
|
||||||
|
str = "0" + str; // magic lightening modifier
|
||||||
|
}
|
||||||
|
|
||||||
let hash = 0;
|
let hash = 0;
|
||||||
for (let i = 0; i < str.length; i++) {
|
for (let i = 0; i < str.length; i++) {
|
||||||
hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
||||||
}
|
}
|
||||||
let colour = '#';
|
|
||||||
|
let color = '#';
|
||||||
for (let i = 0; i < 3; i++) {
|
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);
|
color += ('00' + value.toString(16)).substr(-2);
|
||||||
|
|
||||||
if (this.themeStyle === "dark" && value < 128) {
|
|
||||||
value += 128; // lighten up the colors
|
|
||||||
}
|
}
|
||||||
|
return color;
|
||||||
colour += ('00' + value.toString(16)).substr(-2);
|
|
||||||
}
|
|
||||||
return colour;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rgb2hex(rgb) {
|
rgb2hex(rgb) {
|
||||||
|
|
Loading…
Reference in a new issue