|
5 | 5 | import subprocess |
6 | 6 | from subprocess import check_output as shell |
7 | 7 |
|
8 | | - |
9 | | -template_scheme = {} |
10 | | -template_scheme['light'] = ''' |
11 | | -<style> |
12 | | -span { |
13 | | - background-color: #aee; |
14 | | - color: #444; |
15 | | -} |
16 | | -strong, a { |
17 | | - text-decoration: none; |
18 | | - color: #000; |
19 | | -} |
20 | | -</style> |
21 | | -''' |
22 | | -template_scheme['dark'] = ''' |
23 | | -<style> |
24 | | -span { |
25 | | - background-color: brown; |
26 | | -} |
27 | | -a { |
28 | | - text-decoration: none; |
29 | | -} |
30 | | -</style> |
| 8 | +stylesheet = ''' |
| 9 | + <style> |
| 10 | + div.blame-arrow { |
| 11 | + border-top: 0.4rem solid transparent; |
| 12 | + border-left: 0.5rem solid color(var(--greenish) blend(var(--background) 30%)); |
| 13 | + width: 0; |
| 14 | + height: 0; |
| 15 | + } |
| 16 | + div.blame { |
| 17 | + padding: 0.4rem 0 0.4rem 0.7rem; |
| 18 | + margin: 0 0 0.2rem; |
| 19 | + border-radius: 0 0.2rem 0.2rem 0.2rem; |
| 20 | + background-color: color(var(--greenish) blend(var(--background) 30%)); |
| 21 | + } |
| 22 | + div.blame span.message { |
| 23 | + padding-right: 0.7rem; |
| 24 | + } |
| 25 | + div.blame a { |
| 26 | + text-decoration: inherit; |
| 27 | + } |
| 28 | + div.blame a.close { |
| 29 | + padding: 0.35rem 0.7rem 0.45rem 0.8rem; |
| 30 | + position: relative; |
| 31 | + bottom: 0.05rem; |
| 32 | + border-radius: 0 0.2rem 0.2rem 0; |
| 33 | + font-weight: bold; |
| 34 | + } |
| 35 | + html.dark div.blame a.close { |
| 36 | + background-color: #00000018; |
| 37 | + } |
| 38 | + html.light div.blame a.close { |
| 39 | + background-color: #ffffff18; |
| 40 | + } |
| 41 | + </style> |
31 | 42 | ''' |
32 | 43 |
|
33 | 44 | template = ''' |
34 | | -<span> |
35 | | -{scheme} |
36 | | - <strong>Git Blame:</strong> ({user}) |
| 45 | +<body> |
| 46 | +{stylesheet} |
| 47 | +<div class="blame-arrow"></div> |
| 48 | +<div class="blame"> |
| 49 | +<span class="message"> |
| 50 | +<strong>Git Blame:</strong> ({user}) |
37 | 51 | Updated: {date} {time} | |
38 | 52 | {sha} |
39 | 53 | <a href="copy-{sha}">[Copy]</a> |
40 | 54 | <a href="show-{sha}">[Show]</a> |
41 | | -<a href="close"><close>[X]</close></a> |
| 55 | +<a class="close" href="close">''' + chr(0x00D7) + '''</a> |
42 | 56 | </span> |
| 57 | +</div> |
| 58 | +</body> |
43 | 59 | ''' |
44 | 60 |
|
45 | 61 | # Sometimes this fails on other OS, just error silently |
@@ -130,11 +146,7 @@ def run(self, edit): |
130 | 146 |
|
131 | 147 | sha, user, date, time = self.parse_blame(result) |
132 | 148 |
|
133 | | - settings = sublime.load_settings('Preferences.sublime-settings') |
134 | | - scheme_color = settings.get('gitblame.scheme') or 'dark' |
135 | | - |
136 | | - body = template.format(sha=sha, user=user, date=date, time=time, |
137 | | - scheme=template_scheme.get(scheme_color, '')) |
| 149 | + body = template.format(sha=sha, user=user, date=date, time=time, stylesheet=stylesheet) |
138 | 150 |
|
139 | 151 | phantom = sublime.Phantom(line, body, sublime.LAYOUT_BLOCK, self.on_phantom_close) |
140 | 152 | phantoms.append(phantom) |
|
0 commit comments