Skip to main content

Interactive Typography and Style for JupyterLab

Project description

fonts-icon jupyterlab-fonts

Data-driven Style and Typography for JupyterLab powered by JSS.

ci-badge demo-badge

This is Free Software

We're trying some things out here, and invite you test it out, but make no guarantees that it is good or even works. What we mean by that is covered in the shouty text at the bottom of the LICENSE.

If something is broken, become a contributor and raise an issue, but we cannot guarantee any kind of response time. Similarly, PRs will be reviewed on a time-permitting basis.

Prerequisites

  • JupyterLab >=3
  • Python >=3.7

for specific JupyterLab compatibility, see the changelog.

Installing

pip install jupyterlab-fonts
# or
conda install -c conda-forge jupyterlab-fonts

Uninstalling

We're sorry to see you go!

JupyterLab Extensions

pip uninstall jupyterlab-fonts
# or
conda uninstall jupyterlab-fonts

Usage

JupyterLab Extensions

Quick Configuration with the Jupyter Lab Menu

To change your default fonts, from the main menu, select SettingsFontsCodeFont (or Size or Line Height) and the value you'd like.

Some features of Content, i.e. your rendered Markdown and HTML, are also available, and more will hopefully be added over time.

Full Configuration with the Font Editor

You can view all available font configurations by selecting SettingsFontsGlobal Fonts.... These values will be stored in your JupyterLab settings.

Notebook-specific Configuration

When viewing a notebook, you can change just the fonts for that notebook by clicking fonts-icon in the Notebook toolbar (right now, next to cell type). The font, style changes, and its license information will be stored in the Notebook metadata.

This can rapidly increase the size of your notebook file, and can make it harder to use in collaboration. We're looking into some alterate approaches.

Advanced Configuration

You can pretty much do anything you want from the fonts-icon Fonts section of Advanced Settings... even things entirely unrelated to fonts. There's no guarantee that super-customized styles will work nicely with the Font Editor!

Here's an example of changing how the Notebook looks when in Presentation Mode.

{
  "styles": {
    ":root": {
      "--jp-code-font-family": "'Fira Code Regular', 'Source Code Pro', monospace",
      "--jp-code-font-size": "19px"
    },
    ".jp-mod-presentationMode .jp-Notebook": {
      "& .CodeMirror": {
        "fontSize": "32px"
      },
      "& .jp-InputPrompt, & .jp-OutputPrompt": {
        "display": "none"
      }
    }
  }
}

Note the use of &, which allows for nesting selectors, similar to other CSS preprocessors like LESS.

All JSON-compatible features of the plugins included in jss-preset-default are enabled, with the default settings, and at present will be wrapped in a @global selector.

Use in overrides.json

overrides.json allows for simple, declarative configuration of JupyterLab core and third-party extensions, even after the lab server has been started.

{ '@deathbeds/jupyterlab-fonts:fonts': {} }
# that stuff up there

In binder, one might deploy this with a postBuild script:

#!/usr/bin/env bash
cp overrides.json $NB_PYTHON_PREFIX/share/jupyter/lab/settings

Similarly, this is a well-known file to JupyterLite, making it straightforward to do light customization without needing to build and distribute a theme plugin.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupyterlab-fonts-2.0.0.tar.gz (805.1 kB view hashes)

Uploaded Source

Built Distribution

jupyterlab_fonts-2.0.0-py3-none-any.whl (1.6 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page