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 🙏

© 2026 – Pkg Stats / Ryan Hefner

responsive-scale

v1.0.4

Published

Responsive CSS sizing scale in pixels, powered by custom properties.

Readme

responsive-scale

Responsive CSS sizing scale in pixels, powered by custom properties. This package modernizes the classic 62.5% rem concept by shifting the scaling logic entirely to dynamic CSS variables.

The Concept

Instead of altering the global html font size (which can break user browser accessibility preferences), this package defines a dynamic --base variable set at 10px.

All standard pixel steps from --1 to --1000 (even numbers only) are computed dynamically via calc() relative to this base. When you pass a breakpoint, the --base shrinks, automatically scaling down your entire layout.

  • Desktop (--base: 10px): var(--16) = 1.6 * 10px = 16px
  • Tablet (--base: 8px): var(--16) = 1.6 * 8px = 12.8px
  • Mobile (--base: 6px): var(--16) = 1.6 * 6px = 9.6px

Installation

Install the package via npm:

npm install responsive-scale

Usage

1. Import into JavaScript Frameworks

Import the stylesheet at the root of your application (e.g., main.js, index.js, or app.js):

import "responsive-scale";

2. Import into standard CSS

If your builder supports CSS imports, add this to the top of your global stylesheet:

@import "responsive-scale";

3. Load via CDN (Plain HTML)

Drop this directly into your <head> tag to use it without installation:

<link rel="stylesheet" href="https://unpkg.com" />

How to Use the Scale

The package exposes variables from --1 all the way, evenly, up to --1000. Use them exactly like standard pixel values, omitting the px unit in the variable name:

h1 {
  font-size: var(--32); /* 32px on desktop */
}

p {
  font-size: var(--16); /* 16px on desktop */
}

section {
  padding: var(--24); /* 24px on desktop */
}

Making It Responsive

The scale handles the math. To scale down your entire website layout across different devices, override the --base variable inside media queries in your local CSS file:

/* Your local stylesheet */

/* Tablet Viewport */
@media (max-width: 1024px) {
  :root {
    --base: 8px; /* Automatically drops var(--16) to 12.8px */
  }
}

/* Mobile Viewport */
@media (max-width: 480px) {
  :root {
    --base: 6px; /* Automatically drops var(--16) to 9.6px */
  }
}

Technical Details

The list of the exported variables starts from number 1, then continues only with even numbers till 1000:

:root {
  --base: 10px;
  --1: calc(0.1 * var(--base));
  --2: calc(0.2 * var(--base));
  --4: calc(0.4 * var(--base));
  --6: calc(0.6 * var(--base));
  --10: calc(10 * var(--base));
  --16: calc(16 * var(--base));
  /* ... scales up through every single step ... */
  --1000: calc(100 * var(--base));
}

Extending the package

You can easily extend the package by adding custom responsive variables directly to your own :root selector in your local repo:

:root {
  /* Extending the scale for other cases: */
  --1200: calc(120 * var(--base));
  --1400: calc(140 * var(--base));
  /* ... More variables here ... */
}

⚠️ VSCode Integration (Bonus) - MUST READ

You can configure VSCode so that typing a value like 12px or 12p and hitting the symbol in keyboard right after p, so [ or ], instantly converts it into var(--12).

  1. Open the Command Palette using Ctrl + Shift + P (or Cmd + Shift + P on macOS).
  2. Type and select Preferences: Open Keyboard Shortcuts (JSON).
  3. Paste the following object into your existing shortcuts configuration array: ([ or ] are the keys right after letter p - for faster auto-completion)
  {
    "key": "[",
    "command": "runCommands",
    "when": "editorTextFocus && !editorHasSelection && !suggestWidgetVisible && textInputFocus && resourceExtname == .css",
    "args": {
      "commands": [
        {
          "command": "editor.action.smartSelect.expand",
        },
        {
          "command": "editor.action.insertSnippet",
          "args": {
            "snippet": "${TM_SELECTED_TEXT/(?:(\\d+)\\s*px?)/var(--$1)/}",
          },
        },
      ],
    },
  },

  {
    "key": "]",
    "command": "runCommands",
    "when": "editorTextFocus && !editorHasSelection && !suggestWidgetVisible && textInputFocus && resourceExtname == .css",
    "args": {
      "commands": [
        {
          "command": "editor.action.smartSelect.expand",
        },
        {
          "command": "editor.action.insertSnippet",
          "args": {
            "snippet": "${TM_SELECTED_TEXT/(?:(\\d+)\\s*px?)/var(--$1)/}",
          },
        },
      ],
    },
  },

License

ISC