Skip to content

Commit

Permalink
theme: hack on dev tools and get the basic dark theme copied in
Browse files Browse the repository at this point in the history
  • Loading branch information
tmc committed Mar 30, 2024
1 parent e5b3405 commit 32818ab
Show file tree
Hide file tree
Showing 8 changed files with 512 additions and 147 deletions.
1 change: 1 addition & 0 deletions hack/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
venv
40 changes: 40 additions & 0 deletions hack/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Makefile for development

venv: requirements.in ## Create the virtual environment
python3 -m venv venv
venv/bin/pip install pip-tools
venv/bin/pip-compile requirements.in
venv/bin/pip install -r requirements.txt

.PHONY: run
run: venv ## Run the JupyterLab server
venv/bin/jupyter lab

.PHONY: dev
dev: venv ## Run the JupyterLab server in watch mode
venv/bin/jlpm watch

.PHONY: build
build: venv ## Build the JupyterLab extension
venv/bin/jupyter labextension develop .. --overwrite
venv/bin/jlpm build .. --output=../dist

.PHONY: clean
clean: ## Clean the project
rm -rf venv


.PHONY: set-light-theme
set-light-theme: ## Set the light theme
mkdir -p $(HOME)/.jupyter/lab/user-settings/@jupyterlab/apputils-extension
echo '{"theme":"JupyterLab Light"}' > $(HOME)/.jupyter/lab/user-settings/@jupyterlab/apputils-extension/themes.jupyterlab-settings

.PHONY: set-dark-theme
set-dark-theme: ## Set the dark theme
mkdir -p $(HOME)/.jupyter/lab/user-settings/@jupyterlab/apputils-extension
echo '{"theme":"JupyterLab Dark"}' > $(HOME)/.jupyter/lab/user-settings/@jupyterlab/apputils-extension/themes.jupyterlab-settings

.PHONY: set-brev-theme
set-brev-theme: ## Set the brev theme
mkdir -p $(HOME)/.jupyter/lab/user-settings/@jupyterlab/apputils-extension
echo '{"theme":"brevmakesjupyterlookbetter"}' > $(HOME)/.jupyter/lab/user-settings/@jupyterlab/apputils-extension/themes.jupyterlab-settings
15 changes: 15 additions & 0 deletions hack/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# hacking on brevmakesjupyterlookbetter

This directory contains some tools to make working on this codebase easier.

## Quickstart

```shell
make dev
```

In another terminal:

```shell
make run
```
2 changes: 2 additions & 0 deletions hack/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jupyterlab
-e ..
275 changes: 275 additions & 0 deletions hack/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile requirements.in
#
-e file:///Users/tmc/go/src/github.com/brevdev/brevmakesjupyterlookbetter
# via -r requirements.in
anyio==4.3.0
# via
# httpx
# jupyter-server
appnope==0.1.4
# via ipykernel
argon2-cffi==23.1.0
# via jupyter-server
argon2-cffi-bindings==21.2.0
# via argon2-cffi
arrow==1.3.0
# via isoduration
asttokens==2.4.1
# via stack-data
async-lru==2.0.4
# via jupyterlab
attrs==23.2.0
# via
# jsonschema
# referencing
babel==2.14.0
# via jupyterlab-server
beautifulsoup4==4.12.3
# via nbconvert
bleach==6.1.0
# via nbconvert
certifi==2024.2.2
# via
# httpcore
# httpx
# requests
cffi==1.16.0
# via argon2-cffi-bindings
charset-normalizer==3.3.2
# via requests
comm==0.2.2
# via ipykernel
debugpy==1.8.1
# via ipykernel
decorator==5.1.1
# via ipython
defusedxml==0.7.1
# via nbconvert
executing==2.0.1
# via stack-data
fastjsonschema==2.19.1
# via nbformat
fqdn==1.5.1
# via jsonschema
h11==0.14.0
# via httpcore
httpcore==1.0.5
# via httpx
httpx==0.27.0
# via jupyterlab
idna==3.6
# via
# anyio
# httpx
# jsonschema
# requests
ipykernel==6.29.4
# via jupyterlab
ipython==8.22.2
# via ipykernel
isoduration==20.11.0
# via jsonschema
jedi==0.19.1
# via ipython
jinja2==3.1.3
# via
# jupyter-server
# jupyterlab
# jupyterlab-server
# nbconvert
json5==0.9.24
# via jupyterlab-server
jsonpointer==2.4
# via jsonschema
jsonschema[format-nongpl]==4.21.1
# via
# jupyter-events
# jupyterlab-server
# nbformat
jsonschema-specifications==2023.12.1
# via jsonschema
jupyter-client==8.6.1
# via
# ipykernel
# jupyter-server
# nbclient
jupyter-core==5.7.2
# via
# ipykernel
# jupyter-client
# jupyter-server
# jupyterlab
# nbclient
# nbconvert
# nbformat
jupyter-events==0.10.0
# via jupyter-server
jupyter-lsp==2.2.4
# via jupyterlab
jupyter-server==2.13.0
# via
# jupyter-lsp
# jupyterlab
# jupyterlab-server
# notebook-shim
jupyter-server-terminals==0.5.3
# via jupyter-server
jupyterlab==4.1.5
# via -r requirements.in
jupyterlab-pygments==0.3.0
# via nbconvert
jupyterlab-server==2.25.4
# via jupyterlab
markupsafe==2.1.5
# via
# jinja2
# nbconvert
matplotlib-inline==0.1.6
# via
# ipykernel
# ipython
mistune==3.0.2
# via nbconvert
nbclient==0.10.0
# via nbconvert
nbconvert==7.16.3
# via jupyter-server
nbformat==5.10.3
# via
# jupyter-server
# nbclient
# nbconvert
nest-asyncio==1.6.0
# via ipykernel
notebook-shim==0.2.4
# via jupyterlab
overrides==7.7.0
# via jupyter-server
packaging==24.0
# via
# ipykernel
# jupyter-server
# jupyterlab
# jupyterlab-server
# nbconvert
pandocfilters==1.5.1
# via nbconvert
parso==0.8.3
# via jedi
pexpect==4.9.0
# via ipython
platformdirs==4.2.0
# via jupyter-core
prometheus-client==0.20.0
# via jupyter-server
prompt-toolkit==3.0.43
# via ipython
psutil==5.9.8
# via ipykernel
ptyprocess==0.7.0
# via
# pexpect
# terminado
pure-eval==0.2.2
# via stack-data
pycparser==2.22
# via cffi
pygments==2.17.2
# via
# ipython
# nbconvert
python-dateutil==2.9.0.post0
# via
# arrow
# jupyter-client
python-json-logger==2.0.7
# via jupyter-events
pyyaml==6.0.1
# via jupyter-events
pyzmq==25.1.2
# via
# ipykernel
# jupyter-client
# jupyter-server
referencing==0.34.0
# via
# jsonschema
# jsonschema-specifications
# jupyter-events
requests==2.31.0
# via jupyterlab-server
rfc3339-validator==0.1.4
# via
# jsonschema
# jupyter-events
rfc3986-validator==0.1.1
# via
# jsonschema
# jupyter-events
rpds-py==0.18.0
# via
# jsonschema
# referencing
send2trash==1.8.2
# via jupyter-server
six==1.16.0
# via
# asttokens
# bleach
# python-dateutil
# rfc3339-validator
sniffio==1.3.1
# via
# anyio
# httpx
soupsieve==2.5
# via beautifulsoup4
stack-data==0.6.3
# via ipython
terminado==0.18.1
# via
# jupyter-server
# jupyter-server-terminals
tinycss2==1.2.1
# via nbconvert
tornado==6.4
# via
# ipykernel
# jupyter-client
# jupyter-server
# jupyterlab
# terminado
traitlets==5.14.2
# via
# comm
# ipykernel
# ipython
# jupyter-client
# jupyter-core
# jupyter-events
# jupyter-server
# jupyterlab
# matplotlib-inline
# nbclient
# nbconvert
# nbformat
types-python-dateutil==2.9.0.20240316
# via arrow
uri-template==1.3.0
# via jsonschema
urllib3==2.2.1
# via requests
wcwidth==0.2.13
# via prompt-toolkit
webcolors==1.13
# via jsonschema
webencodings==0.5.1
# via
# bleach
# tinycss2
websocket-client==1.7.0
# via jupyter-server
7 changes: 2 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
} from '@jupyterlab/application';

import { IThemeManager } from '@jupyterlab/apputils';
import '../style/Jupyter-Dark.css';

/**
* Initialization data for the brevmakesjupyterlookbetter extension.
Expand All @@ -15,14 +14,12 @@ const plugin: JupyterFrontEndPlugin<void> = {
autoStart: true,
requires: [IThemeManager],
activate: (app: JupyterFrontEnd, manager: IThemeManager) => {
console.log(
'JupyterLab extension brevmakesjupyterlookbetter is activated!'
);
console.log('🤙🤙🤙');
const style = 'brevmakesjupyterlookbetter/index.css';

manager.register({
name: 'brevmakesjupyterlookbetter',
isLight: true,
isLight: false,
load: () => manager.loadCSS(style),
unload: () => Promise.resolve(undefined)
});
Expand Down
9 changes: 9 additions & 0 deletions style/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,12 @@ pre {
font-size: var(--jp-code-font-size);
line-height: var(--jp-code-line-height);
}

/* fix illegible yellow backround in exception stacktrace */
:where(
.jp-RenderedText[data-mime-type='application/vnd.jupyter.stderr']
pre
.ansi-yellow-bg
) {
color: black;
}
Loading

0 comments on commit 32818ab

Please sign in to comment.