Package: jupyterlab-fonts
jupyterlab-fontsData-driven Style and Typography forJupyterLabpowered byJSS.This isFreeSoftwareWe'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 theLICENSE.If something is broken,become a contributorand raise anissue, but
we cannot guarantee any kind of response time. Similarly,PRs will be reviewed on a
time-permitting basis.PrerequisitesPython >=3.8a Jupyter clientJupyterLab >=3,<5for specific JupyterLab compatibility, see thechangelog.Jupyter Notebook >=7,<8Installingpipinstalljupyterlab-fonts# orcondainstall-cconda-forgejupyterlab-fontsUninstallingWe're sorry to see you go!pipuninstalljupyterlab-fonts# orcondauninstalljupyterlab-fontsUsageJupyterLabQuick Configuration with the Jupyter Lab MenuTo change your default fonts, from the main menu, selectSettings▶Fonts▶Code▶Font(orSizeorLine Height) and the value you'd like.Some features ofContent, i.e. your rendered Markdown and HTML, are also available,
and more will hopefully be added over time.Full Configuration with theFont EditorYou can view all available font configurations by selectingSettings▶Fonts▶Global Fonts.... These values will be stored in your JupyterLab settings.Notebook-specific ConfigurationWhen viewing an.ipynb, change just the fonts forthat fileby clickingin 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 ConfigurationIn JupyterLab, theFontssection ofAdvanced JSON Settingscan control
things entirely unrelated to fonts. There's no guarantee that highly-customized styles
will work nicely with theFont Editor, or with downstream applications ofjupyterlab-fontsmetadata.Here's an example of changing how aNotebookfile looks when inPresentation 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, & .cm-editor":{"fontSize":"32px"},"& .jp-InputPrompt, & .jp-OutputPrompt":{"display":"none"}}}}NotebooksSimilarly, the JupyterLabProperty Inspectorenables these customizations in a
specific.ipynbfile, at both the document and cell level: these are dynamically
generated, and scoped to the document/cellid.Supporting Multiple Application VersionsThe above example shows how different versions of JupyterLab (or Notebook) may use
different DOM classes for the same logical content, such as:ElementJupyterLab <4JupyterLab 4a code editor.CodeMirror.cm-editorJSS PluginsAll JSON-compatible features of thejss-preset-defaultpluginsare
enabled with the default settings, with some specific notes below. For portability,
dynamic JS-based features are not supported.NestingThe the&(ampersand)allows for nesting selectors, as standardized by
theW3C CSS Nesting Moduleand implemented inmany
browsers.GlobalAll settings-derived styles will be wrapped in a@globalselector.In Jupyter WorkflowsUse inoverrides.jsonoverrides.jsonallows for simple, declarative configuration of JupyterLab core and
third-party extensions, even after the lab server has been started.{"@deathbeds/jupyterlab-fonts:fonts":{"styles":{":root":{"--jp-code-font-family":"'Fira Code Regular', 'Source Code Pro', monospace","--jp-code-font-size":"19px"}}}}BinderInbinder, one might deploy this with apostBuildscript:#!/usr/bin/env bashset-eux
mkdir-p"${NB_PYTHON_PREFIX}/share/jupyter/lab/settings"cpoverrides.json"${NB_PYTHON_PREFIX}/share/jupyter/lab/settings"JupyterLiteSimilarly, this is a well-known file toJupyterLite, making it
straightforward to do light customization without needing to build and distribute a full
themeplugin.