-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathgetConfig.ts
More file actions
27 lines (23 loc) · 761 Bytes
/
getConfig.ts
File metadata and controls
27 lines (23 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { GitConfig } from './getGitConfig';
import { Theme, loadTheme } from './themes';
import * as shiki from 'shiki';
export type Config = Theme & {
MIN_LINE_WIDTH: number;
WRAP_LINES: boolean;
HIGHLIGHT_LINE_CHANGES: boolean;
};
export const CONFIG_DEFAULTS: Omit<Config, keyof Theme> = {
MIN_LINE_WIDTH: 80,
WRAP_LINES: true,
HIGHLIGHT_LINE_CHANGES: true,
};
export function getConfig(gitConfig: GitConfig): Config {
const theme = loadTheme(gitConfig.THEME_DIRECTORY, gitConfig.THEME_NAME);
return {
...CONFIG_DEFAULTS,
...theme,
...gitConfig,
SYNTAX_HIGHLIGHTING_THEME: (gitConfig.SYNTAX_HIGHLIGHTING_THEME ??
theme.SYNTAX_HIGHLIGHTING_THEME) as shiki.BundledTheme,
};
}