Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dark High Contrast Theme for JupyterLab with Improved Sidebar Focus Indication #15623

Merged
merged 26 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
957c8f4
Added a high contrast dark theme
m158261 Jan 5, 2024
0abcaa2
Updated variables to improve contrast and improved focus indication o…
m158261 Jan 9, 2024
91933ad
Added a test for toggling high contrast theme
m158261 Jan 10, 2024
c99d6ed
Changed theme name
m158261 Jan 12, 2024
0f06313
Merge branch 'main' into high-contrast-theme
m158261 Jan 19, 2024
887e4f3
Updated versions in package.json
m158261 Jan 19, 2024
ab0963a
Update Playwright Snapshots
github-actions[bot] Jan 19, 2024
978e915
Merge branch 'main' into high-contrast-theme
m158261 Jan 23, 2024
9cbcb34
Update version numbers in package.json
m158261 Jan 23, 2024
36a9525
Updated snapshots
m158261 Jan 25, 2024
f21f6f4
Merge branch 'main' into high-contrast-theme
m158261 Jan 25, 2024
b86eefa
Merge branch 'main' into high-contrast-theme
m158261 Feb 14, 2024
47d1ad4
Update package.json
m158261 Feb 14, 2024
824bfab
Update package.json
m158261 Feb 14, 2024
b3f6cae
Update package.json
m158261 Feb 14, 2024
f913e68
Update package.json - missed quotation marks
m158261 Feb 14, 2024
6dd35e9
Merge branch 'main' into high-contrast-theme
m158261 Feb 22, 2024
c16dd33
Update package.json version numbers
m158261 Feb 22, 2024
8a7eae4
Merge branch 'main' into high-contrast-theme
m158261 Mar 11, 2024
341f44b
Update package.json
m158261 Mar 11, 2024
cb789ca
Made naming more consistent
m158261 Mar 12, 2024
c28423c
Updated naming in test helpers
m158261 Mar 12, 2024
16d720f
Merge branch 'main' into high-contrast-theme
krassowski Mar 29, 2024
547f80f
Update package.json
krassowski Mar 29, 2024
a9f5a97
Merge branch 'main' into high-contrast-theme
krassowski Apr 3, 2024
53baccd
Update package.json
krassowski Apr 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dev_mode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
"@jupyterlab/terminal": "~4.2.0-alpha.2",
"@jupyterlab/terminal-extension": "~4.2.0-alpha.2",
"@jupyterlab/theme-dark-extension": "~4.2.0-alpha.2",
"@jupyterlab/theme-dark-high-contrast-extension": "~4.2.0-alpha.2",
"@jupyterlab/theme-light-extension": "~4.2.0-alpha.2",
"@jupyterlab/toc": "~6.2.0-alpha.2",
"@jupyterlab/toc-extension": "~6.2.0-alpha.2",
Expand Down Expand Up @@ -186,6 +187,7 @@
"@jupyterlab/statusbar-extension": "~4.2.0-alpha.2",
"@jupyterlab/terminal-extension": "~4.2.0-alpha.2",
"@jupyterlab/theme-dark-extension": "~4.2.0-alpha.2",
"@jupyterlab/theme-dark-high-contrast-extension": "~4.2.0-alpha.2",
"@jupyterlab/theme-light-extension": "~4.2.0-alpha.2",
"@jupyterlab/toc-extension": "~6.2.0-alpha.2",
"@jupyterlab/tooltip-extension": "~4.2.0-alpha.2",
Expand Down Expand Up @@ -263,6 +265,7 @@
"@jupyterlab/statusbar-extension": "",
"@jupyterlab/terminal-extension": "",
"@jupyterlab/theme-dark-extension": "",
"@jupyterlab/theme-dark-high-contrast-extension": "",
"@jupyterlab/theme-light-extension": "",
"@jupyterlab/toc-extension": "",
"@jupyterlab/tooltip-extension": "",
Expand Down Expand Up @@ -435,6 +438,7 @@
"@jupyterlab/terminal-extension": "../packages/terminal-extension",
"@jupyterlab/testing": "../packages/testing",
"@jupyterlab/theme-dark-extension": "../packages/theme-dark-extension",
"@jupyterlab/theme-dark-high-contrast-extension": "../packages/theme-dark-high-contrast-extension",
"@jupyterlab/theme-light-extension": "../packages/theme-light-extension",
"@jupyterlab/toc": "../packages/toc",
"@jupyterlab/toc-extension": "../packages/toc-extension",
Expand Down
7 changes: 7 additions & 0 deletions galata/src/helpers/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ export class ThemeHelper {
await this.setTheme('JupyterLab Dark');
}

/**
* Set JupyterLab theme to Dark High Contrast
*/
async setDarkHighContrastTheme(): Promise<void> {
await this.setTheme('JupyterLab Dark High Contrast');
}

Comment on lines +19 to +25
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this? What do folks think?

/**
* Set JupyterLab theme to Light
*/
Expand Down
7 changes: 7 additions & 0 deletions galata/test/jupyterlab/general.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ test.describe('General Tests', () => {
expect(await page.theme.getTheme()).toEqual('JupyterLab Light');
});

test('Toggle Dark High Contrast theme', async ({ page }) => {
await page.theme.setDarkHighContrastTheme();
expect(await page.theme.getTheme()).toEqual(
'JupyterLab Dark High Contrast'
);
});

test('Toggle adaptive theme', async ({ page }) => {
await page.emulateMedia({ colorScheme: 'dark' });
await page.menu.clickMenuItem(
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/application/style/sidepanel.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
position: relative;
}

.jp-SideBar .lm-TabBar-tab:focus-visible {
outline: 4px solid var(--jp-accept-color-active, var(--jp-brand-color1));
outline-offset: -1px;
}

.jp-SideBar .lm-TabBar-tab.lm-mod-current::after {
/* Internal border override pseudo-element */
position: absolute;
Expand Down
1 change: 1 addition & 0 deletions packages/metapackage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
"@jupyterlab/terminal": "^4.2.0-alpha.2",
"@jupyterlab/terminal-extension": "^4.2.0-alpha.2",
"@jupyterlab/theme-dark-extension": "^4.2.0-alpha.2",
"@jupyterlab/theme-dark-high-contrast-extension": "^4.2.0-alpha.2",
"@jupyterlab/theme-light-extension": "^4.2.0-alpha.2",
"@jupyterlab/toc": "^6.2.0-alpha.2",
"@jupyterlab/toc-extension": "^6.2.0-alpha.2",
Expand Down
3 changes: 3 additions & 0 deletions packages/metapackage/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@
{
"path": "../theme-dark-extension"
},
{
"path": "../theme-dark-high-contrast-extension"
},
{
"path": "../theme-light-extension"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/metapackage/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@
{
"path": "../theme-dark-extension"
},
{
"path": "../theme-dark-high-contrast-extension"
},
{
"path": "../theme-light-extension"
},
Expand Down
1 change: 1 addition & 0 deletions packages/shortcuts-extension/style/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@
border-width: var(--jp-border-width);
margin: 3px 0;
padding: 5px 6px;
color: var(--jp-ui-inverse-font-color1);
}

.jp-Shortcuts-Plus:hover {
Expand Down
3 changes: 3 additions & 0 deletions packages/theme-dark-high-contrast-extension/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @jupyterlab/theme-dark-high-contrast-extension

A JupyterLab theme extension which provides a dark high contrast theme.
51 changes: 51 additions & 0 deletions packages/theme-dark-high-contrast-extension/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "@jupyterlab/theme-dark-high-contrast-extension",
"version": "4.2.0-alpha.2",
"description": "JupyterLab - Dark High Contrast Theme",
"homepage": "https://github.com/jupyterlab/jupyterlab",
"bugs": {
"url": "https://github.com/jupyterlab/jupyterlab/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/jupyterlab/jupyterlab.git"
},
"license": "BSD-3-Clause",
"author": "Project Jupyter",
"sideEffects": true,
"main": "lib/index.js",
"types": "lib/index.d.ts",
"directories": {
"lib": "lib/"
},
"files": [
"lib/*.d.ts",
"lib/*.js.map",
"lib/*.js",
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
"style/index.js",
"src/**/*.{ts,tsx}"
],
"scripts": {
"build": "tsc -b",
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
"watch": "tsc -b --watch"
},
"dependencies": {
"@jupyterlab/application": "^4.2.0-alpha.2",
"@jupyterlab/apputils": "^4.3.0-alpha.2",
"@jupyterlab/translation": "^4.2.0-alpha.2"
},
"devDependencies": {
"rimraf": "~5.0.5",
"typedoc": "~0.24.7",
"typescript": "~5.1.6"
},
"publishConfig": {
"access": "public"
},
"jupyterlab": {
"extension": true,
"themePath": "style/theme.css"
}
}
41 changes: 41 additions & 0 deletions packages/theme-dark-high-contrast-extension/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
/**
* @packageDocumentation
* @module theme-dark-high-contrast-extension
*/

import {
JupyterFrontEnd,
JupyterFrontEndPlugin
} from '@jupyterlab/application';
import { IThemeManager } from '@jupyterlab/apputils';
import { ITranslator } from '@jupyterlab/translation';

/**
* A plugin for the Jupyter Dark Theme.
*/
const plugin: JupyterFrontEndPlugin<void> = {
id: '@jupyterlab/theme-dark-high-contrast-extension:plugin',
description: 'Adds a dark high contrast theme.',
requires: [IThemeManager, ITranslator],
activate: (
app: JupyterFrontEnd,
manager: IThemeManager,
translator: ITranslator
) => {
const trans = translator.load('jupyterlab');
const style = '@jupyterlab/theme-dark-high-contrast-extension/index.css';
manager.register({
name: 'JupyterLab Dark High Contrast',
displayName: trans.__('JupyterLab Dark High Contrast'),
isLight: false,
themeScrollbars: true,
load: () => manager.loadCSS(style),
unload: () => Promise.resolve(undefined)
});
},
autoStart: true
};

export default plugin;
8 changes: 8 additions & 0 deletions packages/theme-dark-high-contrast-extension/style/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*-----------------------------------------------------------------------------
| Copyright (c) Jupyter Development Team.
| Distributed under the terms of the Modified BSD License.
|----------------------------------------------------------------------------*/

/* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */
@import url('~@jupyterlab/apputils/style/index.css');
@import url('~@jupyterlab/application/style/index.css');
8 changes: 8 additions & 0 deletions packages/theme-dark-high-contrast-extension/style/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*-----------------------------------------------------------------------------
| Copyright (c) Jupyter Development Team.
| Distributed under the terms of the Modified BSD License.
|----------------------------------------------------------------------------*/

/* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */
import '@jupyterlab/apputils/style/index.js';
import '@jupyterlab/application/style/index.js';
26 changes: 26 additions & 0 deletions packages/theme-dark-high-contrast-extension/style/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*-----------------------------------------------------------------------------
| 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);
}

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