Skip to content

Commit

Permalink
#6687 #6688 WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
piorek committed Apr 16, 2018
1 parent 62b74f6 commit 5a088ac
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 3 deletions.
6 changes: 4 additions & 2 deletions js/lab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@
},
"jupyterlab": {
"extension": "dist/index.js",
"mimeExtension": "dist/javascriptRendererExtension.js"
"mimeExtension": "dist/javascriptRendererExtension.js",
"themeDir": "src/theme/static"
},
"files": [
"dist/**/*.js",
"lib/*"
"lib/*",
"src/theme/static/*.css"
]
}
9 changes: 8 additions & 1 deletion js/lab/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import BeakerxExtension from './plugin';
import BeakerxTreeJupyterLabPlugin from "./tree";
import RequirejsLoader from "./plugin/requirejs";

import { themeLightPlugin, themeDarkPlugin } from "./theme/index";

const beakerx = require('../lib/index.js');

const beakerx_ext = {
Expand Down Expand Up @@ -50,8 +52,13 @@ const requirejs_ext: JupyterLabPlugin<void> = {
}
};

const beakerx_theme_light_ext = themeLightPlugin;
const beakerx_theme_dark_ext = themeDarkPlugin;

export default [
requirejs_ext,
beakerx_ext,
tree_ext
tree_ext,
beakerx_theme_light_ext,
beakerx_theme_dark_ext,
];
75 changes: 75 additions & 0 deletions js/lab/src/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright 2017 TWO SIGMA OPEN SOURCE, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import {
JupyterLab, JupyterLabPlugin
} from "@jupyterlab/application";

import {
IThemeManager
} from "@jupyterlab/apputils";

export const themeLightPlugin: JupyterLabPlugin<void> = {
id: 'beakerx:theme-light:plugin',
requires: [IThemeManager],
activate: function(app: JupyterLab, manager: IThemeManager) {
manager.register({
name: 'BeakerX Light',
load: (): Promise<void> => {
return new Promise<void>((resolve, reject) => {
Promise.all([
manager.loadCSS('@jupyterlab/theme-light-extension/index.css'),
manager.loadCSS('beakerx-jupyterlab/light.css'),
]).then(() => {
return resolve();
}).catch(() => {
return reject();
});
});
},
unload: (): Promise<void> => {
return Promise.resolve(void 0);
}
});
},
autoStart: true
};

export const themeDarkPlugin: JupyterLabPlugin<void> = {
id: 'beakerx:theme-dark:plugin',
requires: [IThemeManager],
activate: function(app: JupyterLab, manager: IThemeManager) {
manager.register({
name: 'BeakerX Dark',
load: (): Promise<void> => {
return new Promise<void>((resolve, reject) => {
Promise.all([
manager.loadCSS('@jupyterlab/theme-dark-extension/index.css'),
manager.loadCSS('beakerx-jupyterlab/dark.css'),
]).then(() => {
return resolve();
}).catch(() => {
return reject();
});
});
},
unload: (): Promise<void> => {
return Promise.resolve(void 0);
}
});
},
autoStart: true
};
26 changes: 26 additions & 0 deletions js/lab/src/theme/static/dark.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright 2017 TWO SIGMA OPEN SOURCE, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@import './fonts.css';

.combplot-plotcontainer {
background-color: var(--jp-layout-color0);
color: var(--jp-content-font-color0);
}

.combplot-plotcoverbox {
fill: var(--jp-layout-color0);
}
19 changes: 19 additions & 0 deletions js/lab/src/theme/static/fonts.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright 2017 TWO SIGMA OPEN SOURCE, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

body {
font-family: "Lato", Helvetica, sans-serif;
}
17 changes: 17 additions & 0 deletions js/lab/src/theme/static/light.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright 2017 TWO SIGMA OPEN SOURCE, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@import './fonts.css';

0 comments on commit 5a088ac

Please sign in to comment.