Skip to content

Commit c5f115e

Browse files
committed
fix attachment logic, use new color theme awareness
fix #428 (for the after-line decoration)
1 parent 9d65d66 commit c5f115e

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/extension.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,32 +52,31 @@ export function activate(): void {
5252
thread.createdAt
5353
)} ago`
5454

55-
// TODO(slimsag): color scheme detection was impossible when this was written, see https://github.com/sourcegraph/sourcegraph/issues/732
56-
const color = window.location.host === 'github.com' ? 'black' : '#0366d6' // #3b4d6e
57-
const backgroundColor = window.location.host === 'github.com' ? 'white' : 'rgba(28, 126, 214, 0.3)' // #151c28
58-
5955
decorations.push({
6056
range: new sourcegraph.Range(
6157
new sourcegraph.Position(
62-
target.relativeSelection.startLine - 1,
58+
target.relativeSelection.startLine,
6359
target.relativeSelection.startCharacter
6460
),
65-
new sourcegraph.Position(
66-
target.relativeSelection.endLine - 1,
67-
target.relativeSelection.endCharacter
68-
)
61+
new sourcegraph.Position(target.relativeSelection.endLine, target.relativeSelection.endCharacter)
6962
),
7063
after: {
7164
contentText: ' 💬 ' + describeThread(shortTitle),
7265
linkURL: thread.inlineURL
73-
? window.location.host
66+
? sourcegraph.internal.clientApplication === 'sourcegraph'
7467
? thread.inlineURL.slice(thread.inlineURL.lastIndexOf('#'))
7568
: thread.inlineURL
7669
: undefined,
7770
hoverMessage: ' ' + describeThread(thread.title),
78-
color,
71+
dark: {
72+
color: '#0d70e0',
73+
backgroundColor: 'rgba(28, 126, 214, 0.15)',
74+
},
75+
light: {
76+
color: 'black',
77+
backgroundColor: 'white',
78+
},
7979
},
80-
backgroundColor,
8180
})
8281
}
8382

0 commit comments

Comments
 (0)