-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
119 lines (104 loc) · 3.68 KB
/
index.js
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
const chroma = require('chroma-js')
const gruvbox = require('./gruvbox')
const gruvboxLightTheme = gruvbox.themes.light
const gruvboxDarkTheme = gruvbox.themes.dark
const theme = {
light: {
activeBorder: gruvboxLightTheme.brightOrange,
background: gruvboxLightTheme.bg0,
border: 'transparent',
cursor: gruvboxDarkTheme.bg4,
foreground: gruvboxLightTheme.fg,
colors: {
black: gruvboxLightTheme.black,
red: gruvboxLightTheme.red,
green: gruvboxLightTheme.green,
yellow: gruvboxLightTheme.yellow,
blue: gruvboxLightTheme.blue,
magenta: gruvboxLightTheme.purple,
cyan: gruvboxLightTheme.cyan,
white: gruvboxLightTheme.white,
lightBlack: gruvboxLightTheme.brightBlack,
lightRed: gruvboxLightTheme.brightRed,
lightGreen: gruvboxLightTheme.brightGreen,
lightYellow: gruvboxLightTheme.brightYellow,
lightBlue: gruvboxLightTheme.brightBlue,
lightMagenta: gruvboxLightTheme.brightPurple,
lightCyan: gruvboxLightTheme.brightAqua,
lightWhite: gruvboxLightTheme.brightWhite,
},
},
dark: {
activeBorder: gruvboxDarkTheme.brightOrange,
background: gruvboxDarkTheme.bg0,
border: 'transparent',
cursor: gruvboxDarkTheme.bg4,
foreground: gruvboxDarkTheme.fg,
colors: {
black: gruvboxDarkTheme.black,
red: gruvboxDarkTheme.red,
green: gruvboxDarkTheme.green,
yellow: gruvboxDarkTheme.yellow,
blue: gruvboxDarkTheme.blue,
magenta: gruvboxDarkTheme.purple,
cyan: gruvboxDarkTheme.cyan,
white: gruvboxDarkTheme.white,
lightBlack: gruvboxDarkTheme.brightBlack,
lightRed: gruvboxDarkTheme.brightRed,
lightGreen: gruvboxDarkTheme.brightGreen,
lightYellow: gruvboxDarkTheme.brightYellow,
lightBlue: gruvboxDarkTheme.brightBlue,
lightMagenta: gruvboxDarkTheme.brightPurple,
lightCyan: gruvboxDarkTheme.brightAqua,
lightWhite: gruvboxDarkTheme.brightWhite,
},
},
}
exports.decorateConfig = (config) => {
const defaults = {
backgroundMode: 'dark',
contrastMode: 'normal',
}
const backgroundMode = config.themeBackgroundMode || defaults.backgroundMode
const contrastMode = config.themeContrastMode || defaults.contrastMode
const selectedTheme = theme[backgroundMode]
// Hyper theme configuration options
const backgroundColor = selectedTheme.background[contrastMode]
const borderColor = selectedTheme.border
const foregroundColor = selectedTheme.foreground
const colors = selectedTheme.colors
const cursorColor = chroma(selectedTheme.cursor).alpha(0.7).css()
// Settings for CSS interpolation
const cursorMixBlendMode = backgroundMode === 'dark' ? 'lighten' : 'darken'
const activeTabBorderColor = selectedTheme.activeBorder
const inactiveTabBackgroundColor = backgroundMode === 'dark'
? chroma(selectedTheme.colors.black).brighten(0.1)
: chroma(selectedTheme.colors.black).darken(0.1)
const inactiveTabTextColor = chroma(foregroundColor).alpha(0.5).css()
const themeConfig = {
backgroundColor,
borderColor,
colors,
cursorColor,
foregroundColor,
css: `
${config.css || ''}
.tabs_title {
color: ${foregroundColor} !important;
}
.tabs_list,
.tab_tab,
.tabs_borderShim {
color: ${inactiveTabTextColor} !important;
background-color: ${inactiveTabBackgroundColor} !important;
border-color: ${borderColor} !important;
}
.tab_tab.tab_active {
color: ${foregroundColor} !important;
background-color: ${backgroundColor} !important;
box-shadow: 0 2px 0 0 ${activeTabBorderColor} inset;
}
`,
}
return Object.assign({}, config, themeConfig)
}