forked from siamak/hyperterm-panda
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
99 lines (95 loc) · 2.66 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
// Constants
const backgroundColor = '#292A2B';
const foregroundColor = '#E6E6E6';
const darkerBackground = 'rgba(0, 0, 0, 0.2)';
const borderColor = '#333';
// Colors
const RED = '#FF2C6D';
const GREEN = '#19f9d8';
const ORANGE = '#FFB86C';
const LIGHT_ORANGE = '#ffcc95';
const BLUE = '#45A9F9';
const LIGHT_BLUE = '#6FC1FF';
const PINK = '#FF75B5';
const LIGHT_PINK = '#FF9AC1';
const CYAN = '#6FC1FF';
const PURPLE = '#B084EB';
const LIGHT_GRAY = foregroundColor;
const MEDIUM_GRAY = '#676B79';
const WHITE = '#FFFFFF';
const colors = {
black: backgroundColor,
red: RED,
green: GREEN,
yellow: ORANGE,
blue: BLUE,
magenta: PINK,
cyan: CYAN,
orange: PURPLE,
white: LIGHT_GRAY,
lightRed: RED,
lightGreen: GREEN,
lightYellow: LIGHT_ORANGE,
lightBlue: LIGHT_BLUE,
lightMagenta: LIGHT_PINK,
lightCyan: CYAN,
lightWhite: WHITE
};
// Apply theme
exports.decorateConfig = (config) => (
Object.assign({}, config, {
backgroundColor,
foregroundColor,
borderColor: borderColor,
cursorColor: foregroundColor,
colors,
css: `
${config.css || ''}
.terms_term x-row{
height: 24px;
}
/* Highlight active tab by making rest of nav darker */
.tabs_list {
background-color: ${darkerBackground} !important;
}
/* Set tab colors */
.tab_tab {
color: ${foregroundColor} !important;
background-color: ${darkerBackground} !important;
border: none !important;
border-right: 1px solid transparent !important;
border-left: 1px solid transparent !important;
}
/* Hide bottom border if tab is active, make bg lighter */
.tab_active {
background-color: ${backgroundColor} !important;
height: calc(100% + 1px);
border-left: 1px solid ${borderColor} !important;
border-right: 1px solid ${borderColor} !important;
}
.tab_tab:last-child {
border-right: 1px solid transparent !important;
}
/* Hide hardcoded black bottom border */
.tab_active:before {
border-bottom: none !important;
}
.tab_text {
border-color: transparent !important;
}
`
})
);
// Development middleware for HMR
exports.middleware = () => (next) => (action) => {
/* eslint-disable no-param-reassign, default-case */
switch (action.type) {
case 'CONFIG_LOAD':
case 'CONFIG_RELOAD':
action.config.foregroundColor = foregroundColor;
action.config.backgroundColor = backgroundColor;
action.config.cursorColor = foregroundColor;
action.config.colors = colors;
}
next(action);
};