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

molten-type

v1.0.0

Published

A set of modular scales for fluid typography that responds to viewport changes. It combines the relationship between a text's font size, its line height and its line length. Instead of adjusting just the font size on a breakpoint by breakpoint basis, a mo

Downloads

3

Readme

molten-type

A set of modular scales for fluid typography that responds to viewport changes. It combines the relationship between a text's font size, its line height and its line length. Instead of adjusting just the font size on a breakpoint by breakpoint basis, a molten type will adjust all three for every viewport size, as the viewport changes.

So what is a modular scale? To put it simply, a modular type scale is a list of font sizes that work well together because they increase by the same ratio. We start with a base font size and multiply it by the ratio to obtain the font sizes we can then use in our CSS.

For example, having a base size of 16px and a ratio of 1.5 will yeild us a list of 16px, 24px, 36px, 54px, 81px, etc.

In addition to changing the font size based on a ratio, molten type will also adjust the font's line height and, if a variable font is used, its font weight. It all happens automatically for each viewport width, and each viewport width will take into account the type scale ratio.

molten type demo

Out of the box, molten type has the following type scales:

| Name | Ratio | File | | :--------------- | :---- | :--------------------- | | Base | 1.000 | index.css | | Minor Second | 1.067 | minor-second.css | | Major Second | 1.125 | major-second.css | | Minor Third | 1.200 | minor-third.css | | Major Third | 1.250 | major-third.css | | Perfect Fourth | 1.333 | perfect-fourth.css | | Augmented Fourth | 1.414 | augmented-fourth.css | | Perfect Fifth | 1.500 | perfect-fifth.css | | Golden Ratio | 1.618 | golden-ratio.css |

Additionally, you can set the ratio yourself by adding the index.css file and overwriting the root CSS property for --type-scale.

<link rel="stylesheet" href="node_modules/molten-type/index.css" />
<style>
  :root {
    --type-scale: 0.8;
  }
</style>

Usage

First install the package from npm:

npm install --save molten-type

Or with yarn

yarn add molten-type

Then link to the stylesheet you want to use:

<link rel="stylesheet" href="node_modules/molten-type/major-third.css" />

Or use it in your SPA or similar. For example, in a Gatsby website, in gatsby-browser.js:

import 'molten-type/major-third.css';

Browser support

If you still have to care about IE11 and below, you cannot use CSS variables. You also need to support calc(), which is a bit flaky in IE11 and below, as well Safari and iOS Safari 6 and 7 (which won't support viewport units in calc()). Sad face!

| Browser | Supported | | :-----------------------------------: | :----------------------------------: | | Google Chrome | Supported | | Safari | Supported | | Firefox | Supported | | Edge | Supported | | Opera | Supported | | Internet Explorer | Not supported |

Contributing

For details, check out the Contributing guide.

LICENSE

MIT

Further reading

molten type would not be possible without the teachings and writings of these folks: