File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed
app/src/app/components/Preview/DevTools/Terminal Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,10 @@ import * as fit from 'xterm/lib/addons/fit/fit';
5
5
6
6
import ResizeObserver from 'resize-observer-polyfill' ;
7
7
8
- import getTerminalTheme , { VSTheme } from '../terminal-theme' ;
8
+ import getTerminalTheme , {
9
+ VSTheme ,
10
+ flattenTerminalTheme ,
11
+ } from '../terminal-theme' ;
9
12
import { TerminalWithFit } from '../types' ;
10
13
11
14
type Props = {
@@ -23,9 +26,14 @@ export class TerminalComponentNoTheme extends React.PureComponent<Props> {
23
26
observer : ResizeObserver ;
24
27
25
28
startTerminal = ( ) => {
29
+ let theme = this . props . theme ;
30
+ // @ts -ignore ignore because it shouldnt exist :)
31
+ if ( this . props . theme . vscodeTheme . colors . terminal ) {
32
+ theme = flattenTerminalTheme ( theme ) ;
33
+ }
26
34
// @ts -ignore
27
35
this . term = new Terminal ( {
28
- theme : getTerminalTheme ( this . props . theme ) ,
36
+ theme : getTerminalTheme ( theme ) ,
29
37
fontFamily : 'Source Code Pro' ,
30
38
fontWeight : 'normal' ,
31
39
fontWeightBold : 'bold' ,
Original file line number Diff line number Diff line change 1
1
import { ITheme } from 'xterm' ;
2
+ import dot from 'dot-object' ;
2
3
3
4
export type VSTheme = {
4
5
background2 : ( ) => void ;
@@ -56,3 +57,11 @@ export default function getTerminalTheme(theme: VSTheme): ITheme {
56
57
cursorAccent : theme . vscodeTheme . colors [ 'terminalCursor.background' ] ,
57
58
} ;
58
59
}
60
+
61
+ export const flattenTerminalTheme = theme => ( {
62
+ ...theme ,
63
+ vscodeTheme : {
64
+ ...theme . vscodeTheme ,
65
+ colors : dot . dot ( theme . vscodeTheme . colors ) ,
66
+ } ,
67
+ } ) ;
Original file line number Diff line number Diff line change @@ -250,7 +250,7 @@ const colors = {
250
250
unfocusedInactiveForeground : tokens . grays [ 400 ] ,
251
251
} ,
252
252
terminal : {
253
- background : tokens . grays [ 900 ] ,
253
+ background : tokens . grays [ 700 ] ,
254
254
foreground : tokens . white ,
255
255
ansiBrightBlack : tokens . blues [ 700 ] ,
256
256
ansiBrightRed : tokens . reds [ 500 ] ,
You can’t perform that action at this time.
0 commit comments