From a508d18239c7da5fe47700f54bfc33a038b3b2a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 12 Jan 2021 18:46:08 +0100 Subject: Use brighter colors as annotation background MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- src/extensions/UserColor.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/extensions') 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) } }, }, -- cgit v1.2.3