diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-01-12 20:46:08 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2021-01-13 21:34:01 +0300 |
commit | a508d18239c7da5fe47700f54bfc33a038b3b2a4 (patch) | |
tree | 78715c89b3d04568138028e360c513a9bf10a796 /src | |
parent | 52810aff5381419a97568701675c88cbaa417a1b (diff) |
Use brighter colors as annotation background
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/extensions/UserColor.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/extensions/UserColor.js b/src/extensions/UserColor.js index 344c08f79..07c189d9f 100644 --- a/src/extensions/UserColor.js +++ b/src/extensions/UserColor.js @@ -135,7 +135,9 @@ class TrackState { class Span { constructor(from, to, commit) { - this.from = from; this.to = to; this.commit = commit + this.from = from + this.to = to + this.commit = commit } } @@ -196,17 +198,16 @@ class UserColor extends Extension { }) tState = tracked } - decos = tState.blameMap - .filter(span => typeof tState.commits[span.commit] !== 'undefined') + .filter(span => span !== null && typeof tState.commits[span.commit] !== 'undefined' && tState.commits[span.commit] !== null) .map(span => { const commit = tState.commits[span.commit] return Decoration.inline(span.from, span.to, { class: 'author-annotation', - style: 'background-color: ' + commit.author.color + '; color:' + (contrastRatio(commit.author.color) > 0.4 ? '#fff' : '#000'), + style: 'background-color: ' + commit.author.color + 'ee;', title: commit.author.name, }) - }) + }).filter(dec => dec !== null) return { tracked, deco: DecorationSet.create(state.doc, decos) } }, }, |