2 |
2 |
3 import * as timers from 'timers'; |
3 import * as timers from 'timers'; |
4 import * as vscode from 'vscode' |
4 import * as vscode from 'vscode' |
5 import { Position, Range, MarkedString, DecorationOptions, DecorationRenderOptions, |
5 import { Position, Range, MarkedString, DecorationOptions, DecorationRenderOptions, |
6 TextDocument, TextEditor, TextEditorDecorationType, ExtensionContext, Uri } from 'vscode' |
6 TextDocument, TextEditor, TextEditorDecorationType, ExtensionContext, Uri } from 'vscode' |
7 import { get_color } from './extension' |
|
8 import { Decoration } from './protocol' |
7 import { Decoration } from './protocol' |
|
8 import * as library from './library' |
9 |
9 |
10 |
10 |
11 /* known decoration types */ |
11 /* known decoration types */ |
12 |
12 |
13 const background_colors = [ |
13 const background_colors = [ |
79 } |
79 } |
80 |
80 |
81 function background(color: string): TextEditorDecorationType |
81 function background(color: string): TextEditorDecorationType |
82 { |
82 { |
83 return decoration( |
83 return decoration( |
84 { light: { backgroundColor: get_color(color, true) }, |
84 { light: { backgroundColor: library.get_color(color, true) }, |
85 dark: { backgroundColor: get_color(color, false) } }) |
85 dark: { backgroundColor: library.get_color(color, false) } }) |
86 } |
86 } |
87 |
87 |
88 function text_color(color: string): TextEditorDecorationType |
88 function text_color(color: string): TextEditorDecorationType |
89 { |
89 { |
90 return decoration( |
90 return decoration( |
91 { light: { color: get_color(color, true) }, |
91 { light: { color: library.get_color(color, true) }, |
92 dark: { color: get_color(color, false) } }) |
92 dark: { color: library.get_color(color, false) } }) |
93 } |
93 } |
94 |
94 |
95 function text_overview_color(color: string): TextEditorDecorationType |
95 function text_overview_color(color: string): TextEditorDecorationType |
96 { |
96 { |
97 return decoration( |
97 return decoration( |
98 { overviewRulerLane: vscode.OverviewRulerLane.Right, |
98 { overviewRulerLane: vscode.OverviewRulerLane.Right, |
99 light: { overviewRulerColor: get_color(color, true) }, |
99 light: { overviewRulerColor: library.get_color(color, true) }, |
100 dark: { overviewRulerColor: get_color(color, false) } }) |
100 dark: { overviewRulerColor: library.get_color(color, false) } }) |
101 } |
101 } |
102 |
102 |
103 function bottom_border(width: string, style: string, color: string): TextEditorDecorationType |
103 function bottom_border(width: string, style: string, color: string): TextEditorDecorationType |
104 { |
104 { |
105 const border = `${width} none; border-bottom-style: ${style}; border-color: ` |
105 const border = `${width} none; border-bottom-style: ${style}; border-color: ` |
106 return decoration( |
106 return decoration( |
107 { light: { border: border + get_color(color, true) }, |
107 { light: { border: border + library.get_color(color, true) }, |
108 dark: { border: border + get_color(color, false) } }) |
108 dark: { border: border + library.get_color(color, false) } }) |
109 } |
109 } |
110 |
110 |
111 |
111 |
112 /* reset */ |
112 /* reset */ |
113 |
113 |