npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wallneradam/custom_css

v0.2.0

Published

Allow to insert custom css into JupyterLab

Downloads

8

Readme

custom-css

Add custom CSS rules to JupyterLab

Usage

After install the plugin, you should see an item called "Custom CSS" in the settings in "Advanced Settings Editor". Here you can specify any CSS rules you want.

{
    "rules": [
        {
            "selector": ".cls-parent .cls-child",
            "styles": [
                "max-height: 100px",
                "font-size: 14px"
            ]
        },
        ...
    ]
}

This will create an inline <style> element in the document's body.

When you save changes it will immediately be active, so you don't need to restart JupyterLab.

Useful JupyterLab CSS tricks with custom-css

Enlarge output height when scrolling is enabled

{
    "rules": [
        {
            "selector": ".jp-CodeCell.jp-mod-outputsScrolled .jp-Cell-outputArea",
            "styles": [
                "max-height: 300px"  // Original is 200px
            ]
        }
    ]
}

Decrease output font size and make the same font for rendered HTML

{
    "rules": [
        {
            "selector": ".jp-OutputArea-output.jp-RenderedText pre, .jp-OutputArea-output.jp-RenderedHTMLCommon",
            "styles": [
                "font-family: var(--jp-code-font-family)", // Make font the same as code font
                "font-size: 90%"  // Make font smaller
            ]
        },

        // Make tables the same font size as the other outputs
        {
            "selector": ".jp-RenderedHTMLCommon table",
            "styles": [
                "font-size: inherit !important" // Make use the same size
            ]
        },
    ]
}

Reorder sidebar icons

You can even reorder sidebar icons and tabs by CSS:

{
    "rules": [
        // Set order to 50 for default
        {
            "selector": ".p-TabBar-tab",
            "styles": [
                "order: 50"
            ]
        },
        // File browser always the 1st
        {
            "selector": ".p-TabBar-tab[data-id='filebrowser']",
            "styles": [
                "order: 1"
            ]
        },
        // Below 50 will be at the top
        {
            "selector": ".p-TabBar-tab[data-id='extensionmanager.main-view']",
            "styles": [
                "order: 2"
            ]
        },
        // Over 50 will be at the bottom
        {
            "selector": ".p-TabBar-tab[data-id='command-palette']",
            "styles": [
                "order: 51"
            ]
        }
    ]
}

Same technic could be good for menu entries and toolbar buttons (not tested).

Grayscale icon if the extension has color icon (which is awful, because every other icons are monochrome)

{
    "rules": [
        // HDF5 toolbar icon
        {
            "selector": ".jp-HdfIcon",
            "styles": [
                "filter: grayscale(1) brightness(3.5)"
            ]
        },
    ]
}

Prerequisites

  • JupyterLab
  • Some CSS knowledge

Installation

jupyter labextension install @wallneradam/custom_css

Development

For a development install (requires npm version 4 or later), do the following in the repository directory:

npm install
npm run build
jupyter labextension link .

To rebuild the package and the JupyterLab app:

npm run build
jupyter lab build