Skip to main content

jupyterlab_change_ui_font_size_fix

Github Actions Status npm version PyPI version Total PyPI downloads JupyterLab 4

A JupyterLab extension that fixes file browser alignment when changing UI font size. Icons and text stay properly aligned across all font sizes.

[!WARNING] This extension is a temporary fix and will be deprecated once JupyterLab core implements proper icon scaling. We plan to submit a PR to the main JupyterLab repository to address this issue natively. Once accepted and released, this extension will no longer be necessary.

The Problem We're Solving

When you change JupyterLab's UI font size, the file browser can show alignment issues. Icons floating in space, text misaligned, the interface looking somewhat off. This extension fixes that alignment problem.

When text scales but icons stay at fixed 20px dimensions, vertical alignment breaks down.

Features

This extension provides two icon sizing modes for maximum flexibility:

Proportional Mode (default) - Icons scale with your font size automatically

  • Icons maintain consistent proportion to text at any font size
  • Configurable scaling multiplier via --jp-custom-icon-scale (default: 1.5)
  • At 13px font: icons are ~19.5px, at 9px font: icons are 13.5px
  • Leverages SVG scalability for crisp rendering at any size

Fixed Mode - Keep icons at constant size while text scales independently

  • Useful when you want smaller text but familiar icon dimensions
  • Configurable via --jp-custom-icon-fixed-size (default: 20px)
  • Standard sizes: 16px, 18px, 20px, 24px, 32px

Both modes include flexbox-based vertical alignment to ensure icons and text stay properly centered regardless of sizing choices.

This extension works well with custom icon extensions like jupyterlab_vscode_icons_extension, maintaining proper alignment with VSCode-style icons across all font sizes.

Problem Statement and Solution

Problem: JupyterLab's file browser uses fixed 20px icon dimensions while text size scales via the --jp-ui-font-size1 CSS variable (default 13px). When users adjust UI font size, icons remain static while text shrinks or grows, breaking vertical alignment. At 9px font size, the misalignment becomes severe with icons appearing significantly larger than text and floating off-center.

Solution: This extension implements dynamic icon sizing using calc(var(--jp-ui-font-size1) * var(--jp-custom-icon-scale)) for proportional mode or fixed pixel values via --jp-custom-icon-fixed-size for fixed mode. Combined with flexbox alignment (display: flex, align-items: center) applied to .jp-DirListing-item, .jp-DirListing-itemIcon, and .jp-DirListing-itemText selectors, icons and text maintain proper vertical centering across all font sizes. SVG icons scale cleanly at any dimension without quality loss.

Configuration

Customize icon sizing through JupyterLab's Custom CSS settings (Settings > Advanced Settings Editor > Custom CSS):

Proportional mode with custom scaling:

:root {
  --jp-custom-icon-mode: proportional;
  --jp-custom-icon-scale: 1.2;  /* Smaller icons (1.2x font size) */
}

Fixed mode at 16px:

:root {
  --jp-custom-icon-mode: fixed;
  --jp-custom-icon-fixed-size: 16px;
}

Proportional mode with larger icons:

:root {
  --jp-custom-icon-scale: 2.0;  /* Icons 2x the font size */
}

The extension uses CSS variables for configuration, making adjustments straightforward without rebuilding or restarting JupyterLab.

Requirements

  • JupyterLab >= 4.0.0

Installation

pip install jupyterlab_change_ui_font_size_fix

Uninstall

pip uninstall jupyterlab_change_ui_font_size_fix

Metadata

Release files for jupyterlab-change-ui-font-size-fix 1.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jupyterlab-change-ui-font-size-fix 1.0.8
File Size Uploaded
jupyterlab_change_ui_font_size_fix-1.0.8.tar.gz 252.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jupyterlab-change-ui-font-size-fix 1.0.8
File Interpreter ABI Platform
jupyterlab_change_ui_font_size_fix-1.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 269.0 kB

Release files / jupyterlab_change_ui_font_size_fix-1.0.8.tar.gz

Download URL jupyterlab_change_ui_font_size_fix-1.0.8.tar.gz
Size 252.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9818327c0eb7cbd3caaebf7f419b71a03341a860bcca36b3dbafbaf997c44aef
BLAKE2b-256 checksum
How to use checksums
6b83799a726997ba98d5c5bcca3eb03e96a128a17f489f0bb230535773efe9f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / jupyterlab_change_ui_font_size_fix-1.0.8-py3-none-any.whl

Download URL jupyterlab_change_ui_font_size_fix-1.0.8-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f1f8c4209439fda005bb65e35c4687c9e9b85ee80ae1d3f8de08b8c432b68ea
BLAKE2b-256 checksum
How to use checksums
dd8fcb4c9ece8ddd4845d57d3b52ac08cece8ff54eba41c474a9b6dac3f09813
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release history Release notifications | RSS feed

This release

1.0.8 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page