jupyterlab_colourful_tab_extension
[!TIP] This extension is part of the stellars_jupyterlab_extensions metapackage. Install all Stellars extensions at once:
pip install stellars_jupyterlab_extensions
A JupyterLab extension that applies pastel colours to tabs for visual identification when many tabs are open.
Coloured tabs make it easy to identify different notebooks and files at a glance.
Right-click any tab to select a colour from the "Tab Colour" submenu.
Features
Assign colours to tabs via right-click context menu for easy visual identification when working with multiple notebooks and files.
Colour options:
- Red, Orange, Yellow, Green, Blue, Purple
- Pastel shades optimised for both light and dark themes
Key features:
- Right-click any tab to assign a colour from the "Set Tab Colour" submenu
- Selected (active) tab shows a distinct shade of its colour so it stands out from other coloured tabs
- Colours persist across browser refreshes via localStorage - a file keeps its colour by path, a terminal for as long as its session runs
- Notebook toolbar matches the active tab colour
- Adjacent inactive tabs sharing the same colour keep a visible divider: the 1px seam between them is recoloured with a contrastive grey computed from the tab colour (darker in the light theme, brighter in the dark theme); the active tab is excluded - its distinct shade already sets it apart. Toggleable via the
dynamicDividersetting, with strength selectable viadividerContrast(low 2:1 hairline, medium 3:1, high 4:1) - Editable palette in the Settings Editor (Settings → Colourful Tabs): inactive and active shades per colour name, for both themes - edits apply live to tabs, toolbar, menu swatches and divider greys
- A terminal's colour is released once its session ends, so the next terminal to reuse that number starts clear
- Tabs with no lasting identity of their own (the launcher, for example) can still be coloured, but the colour lasts only for the session
Yes, this is yet another mass-produced JupyterLab extension that does one trivially simple thing. We are almost embarrassed by how utterly unremarkable it is - just some CSS classes and a context menu. But someone had to do it, and here we are. You're welcome.
Requirements
- JupyterLab >= 4.0.0
Install
To install the extension, execute:
pip install jupyterlab_colourful_tab_extension
Uninstall
To remove the extension, execute:
pip uninstall jupyterlab_colourful_tab_extension
Server extension
The package installs a jupyter_server extension next to the frontend. It serves one route, and its only job is to say which pty process is behind each terminal.
GET /colourful-tab/terminalsanswers{"terminals": {"<name>": "<fingerprint>"}}, where the fingerprint is the terminal's pty process id paired with that process's start time- The browser cannot answer this itself:
GET /api/terminalsreportsnameandlast_activityonly, andlast_activitymoves forward for a reused name exactly as it does for a busy one, so it cannot separate one incarnation of a name from the next - Terminal names are slots - the server hands a closed terminal's name to the next terminal created - so a stored colour is kept only while the fingerprint behind its name is unchanged, and a recycled name starts clear
- With the route unavailable (server extension disabled, or an older release) the frontend falls back to dropping the colours of terminals the server no longer lists as running
- Upgrading from an earlier release clears the terminal tab colours you had set. They were stored with no fingerprint, and an entry that cannot be tied to a live pty process is indistinguishable from the stale entry this check exists to remove. It happens once, at the first start after the upgrade, and only to terminal tabs - colours on file tabs are keyed by path and are untouched
Extension API
Other extensions can tint a widget's tab, learn what the user picked on it, and take the tab's colour over entirely, through the public IColourfulTabs token. It has three members.
- Import the token from
jupyterlab_colourful_tab_extensionand request it as anoptional(orrequires) plugin dependency setColour(widget, colourId)tints a tab, wherecolourIdis one ofrose,peach,lemon,mint,sky,lavender, ornullto clear. The tint rides the widget's Luminotitle.className, so it survives tab re-renders and reordering with no DOM querying. On an unclaimed tab it also drops whatever the right-click menu had stored for that tab, so the two do not fight over itcolourChangedis a Lumino signal carrying{ widgetId, colourId }for every colour picked from the menu and every clear, withcolourIdnull for a clear. It is the only way to learn of a choice: a stored value is a leftover rather than evidence of a click, and a claimed tab is never stored at allclaim(widget)declares that the caller persists this tab's colour and returns anIDisposablethat releases it. Claims are counted, so one holder's dispose leaves another holder's claim standing- The claim suppresses persistence: a pick or a clear on a claimed tab paints it and is announced, writes nothing, and deletes any entry stored for that tab before, because the user has just replaced the choice it recorded
- A stored colour is still restored onto a tab carrying no colour class, which for a claimed tab means its owner has painted nothing. There it must also still match the fingerprint of the terminal now behind its name - an unverified entry is what a recycled name leaves behind - so the owner's colour wins whenever it has one and a verified earlier choice of the user's shows when it does not. Nothing is handed over and no second copy of the colour is made
import {
JupyterFrontEnd,
JupyterFrontEndPlugin
} from '@jupyterlab/application';
import { IColourfulTabs } from 'jupyterlab_colourful_tab_extension';
const plugin: JupyterFrontEndPlugin<void> = {
id: 'my_extension:plugin',
autoStart: true,
optional: [IColourfulTabs],
activate: (app: JupyterFrontEnd, colourfulTabs: IColourfulTabs | null) => {
if (colourfulTabs) {
colourfulTabs.setColour(widget, 'sky');
}
}
};
[!IMPORTANT] The consumer must declare
jupyterlab_colourful_tab_extensionas a sharedsingletonin itspackage.jsonjupyterlab.sharedPackagesblock (with"bundled": false). Without it, module federation serves two copies of the token and theoptionaldependency silently resolves tonull.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jupyterlab_colourful_tab_extension-1.1.20.tar.gz.
File metadata
- Download URL: jupyterlab_colourful_tab_extension-1.1.20.tar.gz
- Upload date:
- Size: 688.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e20efd79add8d3a1fa1196e84806e2a446aa618fa6485329c629bcac8cedad2
|
|
| MD5 |
a602fa244a8413f34f2684dfa932900f
|
|
| BLAKE2b-256 |
b2631af6b122e1ff3a958e0871e155b14f280bd9feafb173b3074f883e8c0c01
|
File details
Details for the file jupyterlab_colourful_tab_extension-1.1.20-py3-none-any.whl.
File metadata
- Download URL: jupyterlab_colourful_tab_extension-1.1.20-py3-none-any.whl
- Upload date:
- Size: 34.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac1b521c238b3523ac29b561ec65e32512fc651b0399e2ffbcd0a80232ab07b6
|
|
| MD5 |
babca8e512b38d5abe36eae65a65283e
|
|
| BLAKE2b-256 |
2cbdda7b40c55da5d1ec808c75bd3325273336e5955496227fc0d7720ce7cdb2
|