mirror of
https://github.com/Steffo99/jupyterlab-theme-sophon.git
synced 2024-11-21 07:34:28 +00:00
First commit
This commit is contained in:
commit
53d11090d5
21 changed files with 1011 additions and 0 deletions
5
.eslintignore
Normal file
5
.eslintignore
Normal file
|
@ -0,0 +1,5 @@
|
|||
node_modules
|
||||
dist
|
||||
coverage
|
||||
**/*.d.ts
|
||||
tests
|
32
.eslintrc.js
Normal file
32
.eslintrc.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
module.exports = {
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/eslint-recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:prettier/recommended'
|
||||
],
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
project: 'tsconfig.json',
|
||||
sourceType: 'module'
|
||||
},
|
||||
plugins: ['@typescript-eslint'],
|
||||
rules: {
|
||||
'@typescript-eslint/interface-name-prefix': [
|
||||
'error',
|
||||
{ prefixWithI: 'always' }
|
||||
],
|
||||
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-namespace': 'off',
|
||||
'@typescript-eslint/no-use-before-define': 'off',
|
||||
'@typescript-eslint/quotes': [
|
||||
'error',
|
||||
'single',
|
||||
{ avoidEscape: true, allowTemplateLiterals: false }
|
||||
],
|
||||
curly: ['error', 'all'],
|
||||
eqeqeq: 'error',
|
||||
'prefer-arrow-callback': 'error'
|
||||
}
|
||||
};
|
32
.github/workflows/build.yml
vendored
Normal file
32
.github/workflows/build.yml
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
pull_request:
|
||||
branches: '*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Install node
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '12.x'
|
||||
- name: Install Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.7'
|
||||
architecture: 'x64'
|
||||
- name: Install dependencies
|
||||
run: python -m pip install jupyterlab==3 jupyter_packaging
|
||||
- name: Build the extension
|
||||
run: |
|
||||
jlpm
|
||||
jlpm run eslint:check
|
||||
python -m pip install .
|
||||
jupyter labextension list 2>&1 | grep -ie "jupyterlab_theme_sophon.*OK"
|
||||
python -m jupyterlab.browser_check
|
109
.gitignore
vendored
Normal file
109
.gitignore
vendored
Normal file
|
@ -0,0 +1,109 @@
|
|||
*.bundle.*
|
||||
lib/
|
||||
node_modules/
|
||||
*.egg-info/
|
||||
.ipynb_checkpoints
|
||||
*.tsbuildinfo
|
||||
jupyterlab_theme_sophon/labextension
|
||||
|
||||
# Created by https://www.gitignore.io/api/python
|
||||
# Edit at https://www.gitignore.io/?templates=python
|
||||
|
||||
### Python ###
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
pip-wheel-metadata/
|
||||
share/python-wheels/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# celery beat schedule file
|
||||
celerybeat-schedule
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# Mr Developer
|
||||
.mr.developer.cfg
|
||||
.project
|
||||
.pydevproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# End of https://www.gitignore.io/api/python
|
4
.prettierignore
Normal file
4
.prettierignore
Normal file
|
@ -0,0 +1,4 @@
|
|||
node_modules
|
||||
**/node_modules
|
||||
**/lib
|
||||
**/package.json
|
3
.prettierrc
Normal file
3
.prettierrc
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"singleQuote": true
|
||||
}
|
28
LICENSE
Normal file
28
LICENSE
Normal file
|
@ -0,0 +1,28 @@
|
|||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2020, Stefano Pigozzi All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
23
MANIFEST.in
Normal file
23
MANIFEST.in
Normal file
|
@ -0,0 +1,23 @@
|
|||
include LICENSE
|
||||
include README.md
|
||||
include pyproject.toml
|
||||
include jupyter-config/jupyterlab_theme_sophon.json
|
||||
|
||||
include package.json
|
||||
include install.json
|
||||
include ts*.json
|
||||
|
||||
graft jupyterlab_theme_sophon/labextension
|
||||
|
||||
# Javascript files
|
||||
graft src
|
||||
graft style
|
||||
prune **/node_modules
|
||||
prune lib
|
||||
|
||||
# Patterns to exclude from any directory
|
||||
global-exclude *~
|
||||
global-exclude *.pyc
|
||||
global-exclude *.pyo
|
||||
global-exclude .git
|
||||
global-exclude .ipynb_checkpoints
|
61
README.md
Normal file
61
README.md
Normal file
|
@ -0,0 +1,61 @@
|
|||
# jupyterlab_theme_sophon
|
||||
|
||||
![Github Actions Status](https://github.com/Steffo99/jupyterlab-theme-sophon/workflows/Build/badge.svg)
|
||||
|
||||
Sophon theme for JupyterLab
|
||||
|
||||
|
||||
## Requirements
|
||||
|
||||
* JupyterLab >= 3.0
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
pip install jupyterlab_theme_sophon
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
### Development install
|
||||
|
||||
Note: You will need NodeJS to build the extension package.
|
||||
|
||||
The `jlpm` command is JupyterLab's pinned version of
|
||||
[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
|
||||
`yarn` or `npm` in lieu of `jlpm` below.
|
||||
|
||||
```bash
|
||||
# Clone the repo to your local environment
|
||||
# Change directory to the jupyterlab_theme_sophon directory
|
||||
# Install package in development mode
|
||||
pip install -e .
|
||||
# Link your development version of the extension with JupyterLab
|
||||
jupyter labextension develop . --overwrite
|
||||
# Rebuild extension Typescript source after making changes
|
||||
jlpm run build
|
||||
```
|
||||
|
||||
You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.
|
||||
|
||||
```bash
|
||||
# Watch the source directory in one terminal, automatically rebuilding when needed
|
||||
jlpm run watch
|
||||
# Run JupyterLab in another terminal
|
||||
jupyter lab
|
||||
```
|
||||
|
||||
With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).
|
||||
|
||||
By default, the `jlpm run build` command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:
|
||||
|
||||
```bash
|
||||
jupyter lab build --minimize=False
|
||||
```
|
||||
|
||||
### Uninstall
|
||||
|
||||
```bash
|
||||
pip uninstall jupyterlab_theme_sophon
|
||||
jupyter labextension uninstall jupyterlab_theme_sophon
|
||||
```
|
21
binder/environment.yml
Normal file
21
binder/environment.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
# a mybinder.org-ready environment for demoing jupyterlab_theme_sophon
|
||||
# this environment may also be used locally on Linux/MacOS/Windows, e.g.
|
||||
#
|
||||
# conda env update --file binder/environment.yml
|
||||
# conda activate jupyterlab_theme_sophon-demo
|
||||
#
|
||||
name: jupyterlab_theme_sophon-demo
|
||||
|
||||
channels:
|
||||
- conda-forge
|
||||
|
||||
dependencies:
|
||||
# runtime dependencies
|
||||
- python >=3.8,<3.9.0a0
|
||||
- jupyterlab >=3,<4.0.0a0
|
||||
# labextension build dependencies
|
||||
- nodejs >=14,<15
|
||||
- pip
|
||||
- wheel
|
||||
# additional packages for demos
|
||||
# - ipywidgets
|
46
binder/postBuild
Executable file
46
binder/postBuild
Executable file
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env python3
|
||||
""" perform a development install of jupyterlab_theme_sophon
|
||||
|
||||
On Binder, this will run _after_ the environment has been fully created from
|
||||
the environment.yml in this directory.
|
||||
|
||||
This script should also run locally on Linux/MacOS/Windows:
|
||||
|
||||
python3 binder/postBuild
|
||||
"""
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path.cwd()
|
||||
|
||||
def _(*args, **kwargs):
|
||||
""" Run a command, echoing the args
|
||||
|
||||
fails hard if something goes wrong
|
||||
"""
|
||||
print("\n\t", " ".join(args), "\n")
|
||||
return_code = subprocess.call(args, **kwargs)
|
||||
if return_code != 0:
|
||||
print("\nERROR", return_code, " ".join(args))
|
||||
sys.exit(return_code)
|
||||
|
||||
# verify the environment is self-consistent before even starting
|
||||
_(sys.executable, "-m", "pip", "check")
|
||||
|
||||
# install the labextension
|
||||
_(sys.executable, "-m", "pip", "install", "-e", ".")
|
||||
|
||||
# verify the environment the extension didn't break anything
|
||||
_(sys.executable, "-m", "pip", "check")
|
||||
|
||||
# list the extensions
|
||||
_("jupyter", "server", "extension", "list")
|
||||
|
||||
# initially list installed extensions to determine if there are any surprises
|
||||
_("jupyter", "labextension", "list")
|
||||
|
||||
|
||||
print("JupyterLab with jupyterlab_theme_sophon is ready to run with:\n")
|
||||
print("\tjupyter lab\n")
|
5
install.json
Normal file
5
install.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"packageManager": "python",
|
||||
"packageName": "jupyterlab_theme_sophon",
|
||||
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab_theme_sophon"
|
||||
}
|
17
jupyterlab_theme_sophon/__init__.py
Normal file
17
jupyterlab_theme_sophon/__init__.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
|
||||
import json
|
||||
import os.path as osp
|
||||
|
||||
from ._version import __version__
|
||||
|
||||
HERE = osp.abspath(osp.dirname(__file__))
|
||||
|
||||
with open(osp.join(HERE, 'labextension', 'package.json')) as fid:
|
||||
data = json.load(fid)
|
||||
|
||||
|
||||
def _jupyter_labextension_paths():
|
||||
return [{
|
||||
'src': 'labextension',
|
||||
'dest': data['name']
|
||||
}]
|
19
jupyterlab_theme_sophon/_version.py
Normal file
19
jupyterlab_theme_sophon/_version.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
__all__ = ['__version__']
|
||||
|
||||
|
||||
def _fetchVersion():
|
||||
import json
|
||||
import os
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
for d, _, _ in os.walk(here):
|
||||
try:
|
||||
with open(os.path.join(d, 'package.json')) as f:
|
||||
return json.load(f)['version']
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
raise FileNotFoundError('Could not find package.json under dir {}'.format(here))
|
||||
|
||||
__version__ = _fetchVersion()
|
67
package.json
Normal file
67
package.json
Normal file
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
"name": "jupyterlab_theme_sophon",
|
||||
"version": "0.1.0",
|
||||
"description": "Sophon theme for JupyterLab",
|
||||
"keywords": [
|
||||
"jupyter",
|
||||
"jupyterlab",
|
||||
"jupyterlab-extension"
|
||||
],
|
||||
"homepage": "https://github.com/Steffo99/jupyterlab-theme-sophon",
|
||||
"bugs": {
|
||||
"url": "https://github.com/Steffo99/jupyterlab-theme-sophon/issues"
|
||||
},
|
||||
"license": "BSD-3-Clause",
|
||||
"author": "Stefano Pigozzi",
|
||||
"files": [
|
||||
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
|
||||
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
|
||||
],
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Steffo99/jupyterlab-theme-sophon.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "jlpm run build:lib && jlpm run build:labextension:dev",
|
||||
"build:prod": "jlpm run build:lib && jlpm run build:labextension",
|
||||
"build:labextension": "jupyter labextension build .",
|
||||
"build:labextension:dev": "jupyter labextension build --development True .",
|
||||
"build:lib": "tsc",
|
||||
"clean": "jlpm run clean:lib",
|
||||
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
|
||||
"clean:labextension": "rimraf jupyterlab_theme_sophon/labextension",
|
||||
"clean:all": "jlpm run clean:lib && jlpm run clean:labextension",
|
||||
"eslint": "eslint . --ext .ts,.tsx --fix",
|
||||
"eslint:check": "eslint . --ext .ts,.tsx",
|
||||
"install:extension": "jupyter labextension develop --overwrite .",
|
||||
"prepare": "jlpm run clean && jlpm run build:prod",
|
||||
"watch": "run-p watch:src watch:labextension",
|
||||
"watch:src": "tsc -w",
|
||||
"watch:labextension": "jupyter labextension watch ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@jupyterlab/application": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jupyterlab/builder": "^3.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^2.27.0",
|
||||
"@typescript-eslint/parser": "^2.27.0",
|
||||
"eslint": "^7.5.0",
|
||||
"eslint-config-prettier": "^6.10.1",
|
||||
"eslint-plugin-prettier": "^3.1.2",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^1.19.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "~4.0.3"
|
||||
},
|
||||
"sideEffects": [
|
||||
"style/*.css"
|
||||
],
|
||||
"jupyterlab": {
|
||||
"extension": true,
|
||||
"themePath": "style/index.css",
|
||||
"outputDir": "jupyterlab_theme_sophon/labextension"
|
||||
}
|
||||
}
|
3
pyproject.toml
Normal file
3
pyproject.toml
Normal file
|
@ -0,0 +1,3 @@
|
|||
[build-system]
|
||||
requires = ["jupyter_packaging~=0.7.9", "jupyterlab>=3.0.0,==3.*", "setuptools>=40.8.0", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
99
setup.py
Normal file
99
setup.py
Normal file
|
@ -0,0 +1,99 @@
|
|||
"""
|
||||
jupyterlab_theme_sophon setup
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
|
||||
from jupyter_packaging import (
|
||||
create_cmdclass, install_npm, ensure_targets,
|
||||
combine_commands, skip_if_exists,
|
||||
)
|
||||
import setuptools
|
||||
|
||||
HERE = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
# The name of the project
|
||||
name = "jupyterlab_theme_sophon"
|
||||
|
||||
# Get our version
|
||||
with open(os.path.join(HERE, 'package.json')) as f:
|
||||
version = json.load(f)['version']
|
||||
|
||||
lab_path = os.path.join(HERE, name, "labextension")
|
||||
|
||||
# Representative files that should exist after a successful build
|
||||
jstargets = [
|
||||
os.path.join(lab_path, "package.json"),
|
||||
]
|
||||
|
||||
package_data_spec = {
|
||||
name: [
|
||||
"*"
|
||||
]
|
||||
}
|
||||
|
||||
labext_name = "jupyterlab_theme_sophon"
|
||||
|
||||
data_files_spec = [
|
||||
("share/jupyter/labextensions/%s" % labext_name, lab_path, "**"),
|
||||
("share/jupyter/labextensions/%s" % labext_name, HERE, "install.json"),
|
||||
]
|
||||
|
||||
cmdclass = create_cmdclass(
|
||||
"jsdeps",
|
||||
package_data_spec=package_data_spec,
|
||||
data_files_spec=data_files_spec
|
||||
)
|
||||
|
||||
js_command = combine_commands(
|
||||
install_npm(HERE, build_cmd="build:prod", npm=["jlpm"]),
|
||||
ensure_targets(jstargets),
|
||||
)
|
||||
|
||||
is_repo = os.path.exists(os.path.join(HERE, '.git'))
|
||||
if is_repo:
|
||||
cmdclass['jsdeps'] = js_command
|
||||
else:
|
||||
cmdclass['jsdeps'] = skip_if_exists(jstargets, js_command)
|
||||
|
||||
|
||||
with open("README.md", "r") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
setup_args = dict(
|
||||
name=name,
|
||||
version=version,
|
||||
url="https://github.com/Steffo99/jupyterlab-theme-sophon",
|
||||
author="Stefano Pigozzi",
|
||||
description="Sophon theme for JupyterLab",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
cmdclass=cmdclass,
|
||||
packages=setuptools.find_packages(),
|
||||
install_requires=[
|
||||
"jupyterlab>=3.0.0,==3.*",
|
||||
],
|
||||
zip_safe=False,
|
||||
include_package_data=True,
|
||||
python_requires=">=3.6",
|
||||
license="BSD-3-Clause",
|
||||
platforms="Linux, Mac OS X, Windows",
|
||||
keywords=["Jupyter", "JupyterLab"],
|
||||
classifiers=[
|
||||
"License :: OSI Approved :: BSD License",
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Framework :: Jupyter",
|
||||
"Framework :: Jupyter :: JupyterLab :: 3",
|
||||
"Framework :: Jupyter :: JupyterLab :: Extensions",
|
||||
"Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt",
|
||||
"Framework :: Jupyter :: JupyterLab :: Extensions :: Themes",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
setuptools.setup(**setup_args)
|
28
src/index.ts
Normal file
28
src/index.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
import {
|
||||
JupyterFrontEnd,
|
||||
JupyterFrontEndPlugin
|
||||
} from '@jupyterlab/application';
|
||||
|
||||
import { IThemeManager } from '@jupyterlab/apputils';
|
||||
|
||||
/**
|
||||
* Initialization data for the jupyterlab_theme_sophon extension.
|
||||
*/
|
||||
const extension: JupyterFrontEndPlugin<void> = {
|
||||
id: 'jupyterlab_theme_sophon',
|
||||
requires: [IThemeManager],
|
||||
autoStart: true,
|
||||
activate: (app: JupyterFrontEnd, manager: IThemeManager) => {
|
||||
console.log('JupyterLab extension jupyterlab_theme_sophon is activated!');
|
||||
const style = 'jupyterlab_theme_sophon/index.css';
|
||||
|
||||
manager.register({
|
||||
name: 'jupyterlab_theme_sophon',
|
||||
isLight: true,
|
||||
load: () => manager.loadCSS(style),
|
||||
unload: () => Promise.resolve(undefined)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default extension;
|
17
style/index.css
Normal file
17
style/index.css
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*-----------------------------------------------------------------------------
|
||||
| Copyright (c) Jupyter Development Team.
|
||||
| Distributed under the terms of the Modified BSD License.
|
||||
|----------------------------------------------------------------------------*/
|
||||
|
||||
@import './variables.css';
|
||||
|
||||
/* Set the default typography for monospace elements */
|
||||
tt,
|
||||
code,
|
||||
kbd,
|
||||
samp,
|
||||
pre {
|
||||
font-family: var(--jp-code-font-family);
|
||||
font-size: var(--jp-code-font-size);
|
||||
line-height: var(--jp-code-line-height);
|
||||
}
|
368
style/variables.css
Normal file
368
style/variables.css
Normal file
|
@ -0,0 +1,368 @@
|
|||
/*-----------------------------------------------------------------------------
|
||||
| Copyright (c) Jupyter Development Team.
|
||||
| Distributed under the terms of the Modified BSD License.
|
||||
|----------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
The following CSS variables define the main, public API for styling JupyterLab.
|
||||
These variables should be used by all plugins wherever possible. In other
|
||||
words, plugins should not define custom colors, sizes, etc unless absolutely
|
||||
necessary. This enables users to change the visual theme of JupyterLab
|
||||
by changing these variables.
|
||||
|
||||
Many variables appear in an ordered sequence (0,1,2,3). These sequences
|
||||
are designed to work well together, so for example, `--jp-border-color1` should
|
||||
be used with `--jp-layout-color1`. The numbers have the following meanings:
|
||||
|
||||
* 0: super-primary, reserved for special emphasis
|
||||
* 1: primary, most important under normal situations
|
||||
* 2: secondary, next most important under normal situations
|
||||
* 3: tertiary, next most important under normal situations
|
||||
|
||||
Throughout JupyterLab, we are mostly following principles from Google's
|
||||
Material Design when selecting colors. We are not, however, following
|
||||
all of MD as it is not optimized for dense, information rich UIs.
|
||||
*/
|
||||
|
||||
:root {
|
||||
/* Elevation
|
||||
*
|
||||
* We style box-shadows using Material Design's idea of elevation. These particular numbers are taken from here:
|
||||
*
|
||||
* https://github.com/material-components/material-components-web
|
||||
* https://material-components-web.appspot.com/elevation.html
|
||||
*/
|
||||
|
||||
--jp-shadow-base-lightness: 0;
|
||||
--jp-shadow-umbra-color: rgba(
|
||||
var(--jp-shadow-base-lightness),
|
||||
var(--jp-shadow-base-lightness),
|
||||
var(--jp-shadow-base-lightness),
|
||||
0.2
|
||||
);
|
||||
--jp-shadow-penumbra-color: rgba(
|
||||
var(--jp-shadow-base-lightness),
|
||||
var(--jp-shadow-base-lightness),
|
||||
var(--jp-shadow-base-lightness),
|
||||
0.14
|
||||
);
|
||||
--jp-shadow-ambient-color: rgba(
|
||||
var(--jp-shadow-base-lightness),
|
||||
var(--jp-shadow-base-lightness),
|
||||
var(--jp-shadow-base-lightness),
|
||||
0.12
|
||||
);
|
||||
--jp-elevation-z0: none;
|
||||
--jp-elevation-z1: 0px 2px 1px -1px var(--jp-shadow-umbra-color),
|
||||
0px 1px 1px 0px var(--jp-shadow-penumbra-color),
|
||||
0px 1px 3px 0px var(--jp-shadow-ambient-color);
|
||||
--jp-elevation-z2: 0px 3px 1px -2px var(--jp-shadow-umbra-color),
|
||||
0px 2px 2px 0px var(--jp-shadow-penumbra-color),
|
||||
0px 1px 5px 0px var(--jp-shadow-ambient-color);
|
||||
--jp-elevation-z4: 0px 2px 4px -1px var(--jp-shadow-umbra-color),
|
||||
0px 4px 5px 0px var(--jp-shadow-penumbra-color),
|
||||
0px 1px 10px 0px var(--jp-shadow-ambient-color);
|
||||
--jp-elevation-z6: 0px 3px 5px -1px var(--jp-shadow-umbra-color),
|
||||
0px 6px 10px 0px var(--jp-shadow-penumbra-color),
|
||||
0px 1px 18px 0px var(--jp-shadow-ambient-color);
|
||||
--jp-elevation-z8: 0px 5px 5px -3px var(--jp-shadow-umbra-color),
|
||||
0px 8px 10px 1px var(--jp-shadow-penumbra-color),
|
||||
0px 3px 14px 2px var(--jp-shadow-ambient-color);
|
||||
--jp-elevation-z12: 0px 7px 8px -4px var(--jp-shadow-umbra-color),
|
||||
0px 12px 17px 2px var(--jp-shadow-penumbra-color),
|
||||
0px 5px 22px 4px var(--jp-shadow-ambient-color);
|
||||
--jp-elevation-z16: 0px 8px 10px -5px var(--jp-shadow-umbra-color),
|
||||
0px 16px 24px 2px var(--jp-shadow-penumbra-color),
|
||||
0px 6px 30px 5px var(--jp-shadow-ambient-color);
|
||||
--jp-elevation-z20: 0px 10px 13px -6px var(--jp-shadow-umbra-color),
|
||||
0px 20px 31px 3px var(--jp-shadow-penumbra-color),
|
||||
0px 8px 38px 7px var(--jp-shadow-ambient-color);
|
||||
--jp-elevation-z24: 0px 11px 15px -7px var(--jp-shadow-umbra-color),
|
||||
0px 24px 38px 3px var(--jp-shadow-penumbra-color),
|
||||
0px 9px 46px 8px var(--jp-shadow-ambient-color);
|
||||
|
||||
/* Borders
|
||||
*
|
||||
* The following variables, specify the visual styling of borders in JupyterLab.
|
||||
*/
|
||||
|
||||
--jp-border-width: 1px;
|
||||
--jp-border-color0: var(--md-grey-400);
|
||||
--jp-border-color1: var(--md-grey-400);
|
||||
--jp-border-color2: var(--md-grey-300);
|
||||
--jp-border-color3: var(--md-grey-200);
|
||||
--jp-border-radius: 2px;
|
||||
|
||||
/* UI Fonts
|
||||
*
|
||||
* The UI font CSS variables are used for the typography all of the JupyterLab
|
||||
* user interface elements that are not directly user generated content.
|
||||
*
|
||||
* The font sizing here is done assuming that the body font size of --jp-ui-font-size1
|
||||
* is applied to a parent element. When children elements, such as headings, are sized
|
||||
* in em all things will be computed relative to that body size.
|
||||
*/
|
||||
|
||||
--jp-ui-font-scale-factor: 1.2;
|
||||
--jp-ui-font-size0: 0.83333em;
|
||||
--jp-ui-font-size1: 13px; /* Base font size */
|
||||
--jp-ui-font-size2: 1.2em;
|
||||
--jp-ui-font-size3: 1.44em;
|
||||
|
||||
--jp-ui-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica,
|
||||
Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
||||
|
||||
/*
|
||||
* Use these font colors against the corresponding main layout colors.
|
||||
* In a light theme, these go from dark to light.
|
||||
*/
|
||||
|
||||
/* Defaults use Material Design specification */
|
||||
--jp-ui-font-color0: rgba(0, 0, 0, 1);
|
||||
--jp-ui-font-color1: rgba(0, 0, 0, 0.87);
|
||||
--jp-ui-font-color2: rgba(0, 0, 0, 0.54);
|
||||
--jp-ui-font-color3: rgba(0, 0, 0, 0.38);
|
||||
|
||||
/*
|
||||
* Use these against the brand/accent/warn/error colors.
|
||||
* These will typically go from light to darker, in both a dark and light theme.
|
||||
*/
|
||||
|
||||
--jp-ui-inverse-font-color0: rgba(255, 255, 255, 1);
|
||||
--jp-ui-inverse-font-color1: rgba(255, 255, 255, 1);
|
||||
--jp-ui-inverse-font-color2: rgba(255, 255, 255, 0.7);
|
||||
--jp-ui-inverse-font-color3: rgba(255, 255, 255, 0.5);
|
||||
|
||||
/* Content Fonts
|
||||
*
|
||||
* Content font variables are used for typography of user generated content.
|
||||
*
|
||||
* The font sizing here is done assuming that the body font size of --jp-content-font-size1
|
||||
* is applied to a parent element. When children elements, such as headings, are sized
|
||||
* in em all things will be computed relative to that body size.
|
||||
*/
|
||||
|
||||
--jp-content-line-height: 1.6;
|
||||
--jp-content-font-scale-factor: 1.2;
|
||||
--jp-content-font-size0: 0.83333em;
|
||||
--jp-content-font-size1: 14px; /* Base font size */
|
||||
--jp-content-font-size2: 1.2em;
|
||||
--jp-content-font-size3: 1.44em;
|
||||
--jp-content-font-size4: 1.728em;
|
||||
--jp-content-font-size5: 2.0736em;
|
||||
|
||||
/* This gives a magnification of about 125% in presentation mode over normal. */
|
||||
--jp-content-presentation-font-size1: 17px;
|
||||
|
||||
--jp-content-heading-line-height: 1;
|
||||
--jp-content-heading-margin-top: 1.2em;
|
||||
--jp-content-heading-margin-bottom: 0.8em;
|
||||
--jp-content-heading-font-weight: 500;
|
||||
|
||||
/* Defaults use Material Design specification */
|
||||
--jp-content-font-color0: rgba(0, 0, 0, 1);
|
||||
--jp-content-font-color1: rgba(0, 0, 0, 0.87);
|
||||
--jp-content-font-color2: rgba(0, 0, 0, 0.54);
|
||||
--jp-content-font-color3: rgba(0, 0, 0, 0.38);
|
||||
|
||||
--jp-content-link-color: var(--md-blue-700);
|
||||
|
||||
--jp-content-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
|
||||
Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
|
||||
'Segoe UI Symbol';
|
||||
|
||||
/*
|
||||
* Code Fonts
|
||||
*
|
||||
* Code font variables are used for typography of code and other monospaces content.
|
||||
*/
|
||||
|
||||
--jp-code-font-size: 13px;
|
||||
--jp-code-line-height: 1.3077; /* 17px for 13px base */
|
||||
--jp-code-padding: 0.385em; /* 5px for 13px base */
|
||||
--jp-code-font-family-default: Menlo, Consolas, 'DejaVu Sans Mono', monospace;
|
||||
--jp-code-font-family: var(--jp-code-font-family-default);
|
||||
|
||||
/* This gives a magnification of about 125% in presentation mode over normal. */
|
||||
--jp-code-presentation-font-size: 16px;
|
||||
|
||||
/* may need to tweak cursor width if you change font size */
|
||||
--jp-code-cursor-width0: 1.4px;
|
||||
--jp-code-cursor-width1: 2px;
|
||||
--jp-code-cursor-width2: 4px;
|
||||
|
||||
/* Layout
|
||||
*
|
||||
* The following are the main layout colors use in JupyterLab. In a light
|
||||
* theme these would go from light to dark.
|
||||
*/
|
||||
|
||||
--jp-layout-color0: white;
|
||||
--jp-layout-color1: white;
|
||||
--jp-layout-color2: var(--md-grey-200);
|
||||
--jp-layout-color3: var(--md-grey-400);
|
||||
--jp-layout-color4: var(--md-grey-600);
|
||||
|
||||
/* Inverse Layout
|
||||
*
|
||||
* The following are the inverse layout colors use in JupyterLab. In a light
|
||||
* theme these would go from dark to light.
|
||||
*/
|
||||
|
||||
--jp-inverse-layout-color0: #111111;
|
||||
--jp-inverse-layout-color1: var(--md-grey-900);
|
||||
--jp-inverse-layout-color2: var(--md-grey-800);
|
||||
--jp-inverse-layout-color3: var(--md-grey-700);
|
||||
--jp-inverse-layout-color4: var(--md-grey-600);
|
||||
|
||||
/* Brand/accent */
|
||||
|
||||
--jp-brand-color0: var(--md-blue-700);
|
||||
--jp-brand-color1: var(--md-blue-500);
|
||||
--jp-brand-color2: var(--md-blue-300);
|
||||
--jp-brand-color3: var(--md-blue-100);
|
||||
|
||||
--jp-accent-color0: var(--md-green-700);
|
||||
--jp-accent-color1: var(--md-green-500);
|
||||
--jp-accent-color2: var(--md-green-300);
|
||||
--jp-accent-color3: var(--md-green-100);
|
||||
|
||||
/* State colors (warn, error, success, info) */
|
||||
|
||||
--jp-warn-color0: var(--md-orange-700);
|
||||
--jp-warn-color1: var(--md-orange-500);
|
||||
--jp-warn-color2: var(--md-orange-300);
|
||||
--jp-warn-color3: var(--md-orange-100);
|
||||
|
||||
--jp-error-color0: var(--md-red-700);
|
||||
--jp-error-color1: var(--md-red-500);
|
||||
--jp-error-color2: var(--md-red-300);
|
||||
--jp-error-color3: var(--md-red-100);
|
||||
|
||||
--jp-success-color0: var(--md-green-700);
|
||||
--jp-success-color1: var(--md-green-500);
|
||||
--jp-success-color2: var(--md-green-300);
|
||||
--jp-success-color3: var(--md-green-100);
|
||||
|
||||
--jp-info-color0: var(--md-cyan-700);
|
||||
--jp-info-color1: var(--md-cyan-500);
|
||||
--jp-info-color2: var(--md-cyan-300);
|
||||
--jp-info-color3: var(--md-cyan-100);
|
||||
|
||||
/* Cell specific styles */
|
||||
|
||||
--jp-cell-padding: 5px;
|
||||
|
||||
--jp-cell-collapser-width: 8px;
|
||||
--jp-cell-collapser-min-height: 20px;
|
||||
--jp-cell-collapser-not-active-hover-opacity: 0.6;
|
||||
|
||||
--jp-cell-editor-background: var(--md-grey-100);
|
||||
--jp-cell-editor-border-color: var(--md-grey-300);
|
||||
--jp-cell-editor-box-shadow: inset 0 0 2px var(--md-blue-300);
|
||||
--jp-cell-editor-active-background: var(--jp-layout-color0);
|
||||
--jp-cell-editor-active-border-color: var(--jp-brand-color1);
|
||||
|
||||
--jp-cell-prompt-width: 64px;
|
||||
--jp-cell-prompt-font-family: 'Source Code Pro', monospace;
|
||||
--jp-cell-prompt-letter-spacing: 0px;
|
||||
--jp-cell-prompt-opacity: 1;
|
||||
--jp-cell-prompt-not-active-opacity: 0.5;
|
||||
--jp-cell-prompt-not-active-font-color: var(--md-grey-700);
|
||||
/* A custom blend of MD grey and blue 600
|
||||
* See https://meyerweb.com/eric/tools/color-blend/#546E7A:1E88E5:5:hex */
|
||||
--jp-cell-inprompt-font-color: #307fc1;
|
||||
/* A custom blend of MD grey and orange 600
|
||||
* https://meyerweb.com/eric/tools/color-blend/#546E7A:F4511E:5:hex */
|
||||
--jp-cell-outprompt-font-color: #bf5b3d;
|
||||
|
||||
/* Notebook specific styles */
|
||||
|
||||
--jp-notebook-padding: 10px;
|
||||
--jp-notebook-select-background: var(--jp-layout-color1);
|
||||
--jp-notebook-multiselected-color: var(--md-blue-50);
|
||||
|
||||
/* The scroll padding is calculated to fill enough space at the bottom of the
|
||||
notebook to show one single-line cell (with appropriate padding) at the top
|
||||
when the notebook is scrolled all the way to the bottom. We also subtract one
|
||||
pixel so that no scrollbar appears if we have just one single-line cell in the
|
||||
notebook. This padding is to enable a 'scroll past end' feature in a notebook.
|
||||
*/
|
||||
--jp-notebook-scroll-padding: calc(
|
||||
100% - var(--jp-code-font-size) * var(--jp-code-line-height) -
|
||||
var(--jp-code-padding) - var(--jp-cell-padding) - 1px
|
||||
);
|
||||
|
||||
/* Rendermime styles */
|
||||
|
||||
--jp-rendermime-error-background: #fdd;
|
||||
--jp-rendermime-table-row-background: var(--md-grey-100);
|
||||
--jp-rendermime-table-row-hover-background: var(--md-light-blue-50);
|
||||
|
||||
/* Dialog specific styles */
|
||||
|
||||
--jp-dialog-background: rgba(0, 0, 0, 0.25);
|
||||
|
||||
/* Console specific styles */
|
||||
|
||||
--jp-console-padding: 10px;
|
||||
|
||||
/* Toolbar specific styles */
|
||||
|
||||
--jp-toolbar-border-color: var(--jp-border-color1);
|
||||
--jp-toolbar-micro-height: 8px;
|
||||
--jp-toolbar-background: var(--jp-layout-color1);
|
||||
--jp-toolbar-box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.24);
|
||||
--jp-toolbar-header-margin: 4px 4px 0px 4px;
|
||||
--jp-toolbar-active-background: var(--md-grey-300);
|
||||
|
||||
/* Input field styles */
|
||||
|
||||
--jp-input-box-shadow: inset 0 0 2px var(--md-blue-300);
|
||||
--jp-input-active-background: var(--jp-layout-color1);
|
||||
--jp-input-hover-background: var(--jp-layout-color1);
|
||||
--jp-input-background: var(--md-grey-100);
|
||||
--jp-input-border-color: var(--jp-border-color1);
|
||||
--jp-input-active-border-color: var(--jp-brand-color1);
|
||||
|
||||
/* General editor styles */
|
||||
|
||||
--jp-editor-selected-background: #d9d9d9;
|
||||
--jp-editor-selected-focused-background: #d7d4f0;
|
||||
--jp-editor-cursor-color: var(--jp-ui-font-color0);
|
||||
|
||||
/* Code mirror specific styles */
|
||||
|
||||
--jp-mirror-editor-keyword-color: #008000;
|
||||
--jp-mirror-editor-atom-color: #88f;
|
||||
--jp-mirror-editor-number-color: #080;
|
||||
--jp-mirror-editor-def-color: #00f;
|
||||
--jp-mirror-editor-variable-color: var(--md-grey-900);
|
||||
--jp-mirror-editor-variable-2-color: #05a;
|
||||
--jp-mirror-editor-variable-3-color: #085;
|
||||
--jp-mirror-editor-punctuation-color: #05a;
|
||||
--jp-mirror-editor-property-color: #05a;
|
||||
--jp-mirror-editor-operator-color: #aa22ff;
|
||||
--jp-mirror-editor-comment-color: #408080;
|
||||
--jp-mirror-editor-string-color: #ba2121;
|
||||
--jp-mirror-editor-string-2-color: #708;
|
||||
--jp-mirror-editor-meta-color: #aa22ff;
|
||||
--jp-mirror-editor-qualifier-color: #555;
|
||||
--jp-mirror-editor-builtin-color: #008000;
|
||||
--jp-mirror-editor-bracket-color: #997;
|
||||
--jp-mirror-editor-tag-color: #170;
|
||||
--jp-mirror-editor-attribute-color: #00c;
|
||||
--jp-mirror-editor-header-color: blue;
|
||||
--jp-mirror-editor-quote-color: #090;
|
||||
--jp-mirror-editor-link-color: #00c;
|
||||
--jp-mirror-editor-error-color: #f00;
|
||||
--jp-mirror-editor-hr-color: #999;
|
||||
|
||||
/* Vega extension styles */
|
||||
|
||||
--jp-vega-background: white;
|
||||
|
||||
/* Sidebar-related styles */
|
||||
|
||||
--jp-sidebar-min-width: 180px;
|
||||
}
|
24
tsconfig.json
Normal file
24
tsconfig.json
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"composite": true,
|
||||
"declaration": true,
|
||||
"esModuleInterop": true,
|
||||
"incremental": true,
|
||||
"jsx": "react",
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"noEmitOnError": true,
|
||||
"noImplicitAny": true,
|
||||
"noUnusedLocals": true,
|
||||
"preserveWatchOutput": true,
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "lib",
|
||||
"rootDir": "src",
|
||||
"strict": true,
|
||||
"strictNullChecks": false,
|
||||
"target": "es2017",
|
||||
"types": []
|
||||
},
|
||||
"include": ["src/*"]
|
||||
}
|
Loading…
Reference in a new issue