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';
55
66import ResizeObserver from 'resize-observer-polyfill' ;
77
8- import getTerminalTheme , { VSTheme } from '../terminal-theme' ;
8+ import getTerminalTheme , {
9+ VSTheme ,
10+ flattenTerminalTheme ,
11+ } from '../terminal-theme' ;
912import { TerminalWithFit } from '../types' ;
1013
1114type Props = {
@@ -23,9 +26,14 @@ export class TerminalComponentNoTheme extends React.PureComponent<Props> {
2326 observer : ResizeObserver ;
2427
2528 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+ }
2634 // @ts -ignore
2735 this . term = new Terminal ( {
28- theme : getTerminalTheme ( this . props . theme ) ,
36+ theme : getTerminalTheme ( theme ) ,
2937 fontFamily : 'Source Code Pro' ,
3038 fontWeight : 'normal' ,
3139 fontWeightBold : 'bold' ,
Original file line number Diff line number Diff line change 11import { ITheme } from 'xterm' ;
2+ import dot from 'dot-object' ;
23
34export type VSTheme = {
45 background2 : ( ) => void ;
@@ -56,3 +57,11 @@ export default function getTerminalTheme(theme: VSTheme): ITheme {
5657 cursorAccent : theme . vscodeTheme . colors [ 'terminalCursor.background' ] ,
5758 } ;
5859}
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 = {
250250 unfocusedInactiveForeground : tokens . grays [ 400 ] ,
251251 } ,
252252 terminal : {
253- background : tokens . grays [ 900 ] ,
253+ background : tokens . grays [ 700 ] ,
254254 foreground : tokens . white ,
255255 ansiBrightBlack : tokens . blues [ 700 ] ,
256256 ansiBrightRed : tokens . reds [ 500 ] ,
You can’t perform that action at this time.
0 commit comments