@@ -12,6 +12,7 @@ import { Observable } from 'rxjs/Observable';
12
12
import * as uuid from 'uuid/v4' ;
13
13
import * as vscode from 'vscode' ;
14
14
15
+ import { IWorkspaceService } from '../common/application/types' ;
15
16
import { IFileSystem } from '../common/platform/types' ;
16
17
import { IDisposableRegistry , ILogger } from '../common/types' ;
17
18
import { createDeferred } from '../common/utils/async' ;
@@ -36,7 +37,8 @@ export class JupyterServer implements INotebookServer {
36
37
@inject ( INotebookProcess ) private process : INotebookProcess ,
37
38
@inject ( IFileSystem ) private fileSystem : IFileSystem ,
38
39
@inject ( IDisposableRegistry ) private disposableRegistry : IDisposableRegistry ,
39
- @inject ( IJupyterExecution ) private jupyterExecution : IJupyterExecution ) {
40
+ @inject ( IJupyterExecution ) private jupyterExecution : IJupyterExecution ,
41
+ @inject ( IWorkspaceService ) private workspaceService : IWorkspaceService ) {
40
42
}
41
43
42
44
public start = async ( ) : Promise < boolean > => {
@@ -84,9 +86,18 @@ export class JupyterServer implements INotebookServer {
84
86
// Wait for it to be ready
85
87
await this . session . kernel . ready ;
86
88
87
- // Setup the default imports (this should be configurable in the future)
89
+ // Check for dark theme, if so set matplot lib to use dark_background settings
90
+ let darkTheme : boolean = false ;
91
+ const workbench = this . workspaceService . getConfiguration ( 'workbench' ) ;
92
+ if ( workbench ) {
93
+ const theme = workbench . get < string > ( 'colorTheme' ) ;
94
+ if ( theme ) {
95
+ darkTheme = / d a r k / i. test ( theme ) ;
96
+ }
97
+ }
98
+
88
99
this . executeSilently (
89
- ' import pandas as pd\r\nimport numpy\r\n%matplotlib inline\r\nimport matplotlib.pyplot as plt'
100
+ ` import pandas as pd\r\nimport numpy\r\n%matplotlib inline\r\nimport matplotlib.pyplot as plt${ darkTheme ? '\r\nfrom matplotlib import style\r\nstyle.use(\'dark_background\')' : '' } `
90
101
) . ignoreErrors ( ) ;
91
102
92
103
return true ;
0 commit comments