Typography.js
A powerful toolkit for building websites with beautiful design
Install / Use
/learn @KyleAMathews/Typography.jsREADME
Typography.js [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status]
A powerful toolkit for building websites with beautiful design.
Install
npm install typography
Demo/playground
https://kyleamathews.github.io/typography.js
Why
The goal of Typography.js is to provide a high-level elegant API for expressing typographic design intent.
Typography is a complex system of interrelated styles. 100s of style declarations on dozens of elements must be in harmonious order. Trying one design change can mean making dozens of tedious recalculations and CSS value changes. Creating new Typography themes with CSS feels hard.
Typography.js provides a vastly simpler way to define and explore typography designs.
You provide configuration to the Typography.js JS api and it uses its Typography engine to generate CSS for block and inline elements.
Typography.js makes it easy to create designs that are unique, personal, and custom to your project.
Themes & Plugins
- themes: Typography.js themes are simple Javascript objects. As such they're easy to share across projects or even open source and share via NPM.
- plugins: Plugins are functions that extend or modify the core Typography engine. They can change how headers are styled or add specialized styles e.g. for code or tables.
Sites that use Typography.js
- bricolage.io (source)
- React Headroom (source)
- Gatsby Blog Starter (source)
- ollieglass.com
- privatimkerei-hoffmann.de (source)
- Rijo Joy
- Greg Bastianelli
- Edit this file to add yours!
Javascript usage
import Typography from 'typography'
const typography = new Typography({
baseFontSize: '18px',
baseLineHeight: 1.45,
headerFontFamily: ['Avenir Next', 'Helvetica Neue', 'Segoe UI', 'Helvetica', 'Arial', 'sans-serif'],
bodyFontFamily: ['Georgia', 'serif'],
// See below for the full list of options.
})
// Output CSS as string.
typography.toString()
// Or insert styles directly into the <head> (works well for client-only
// JS web apps.)
typography.injectStyles()
Themes
We maintain 30 (and counting) themes that are ready to use on your next project. These are each published as separate NPM packages. Explore themes at http://kyleamathews.github.io/typography.js.
Using themes
Here's an example of how to use the Funston theme.
- First save the package to your project
npm install --save typography-theme-funston - Then import and pass into Typography when initializing.
import Typography from 'typography'
import funstonTheme from 'typography-theme-funston'
const typography = new Typography(funstonTheme)
Customizing themes
Themes are just javascript objects so it's easy to modify them as needed. For example, if you're using the Funston theme but want to increase the base font size slightly:
import Typography from 'typography'
import funstonTheme from 'typography-theme-funston'
funstonTheme.baseFontSize = '22px' // was 20px.
const typography = new Typography(funstonTheme)
Or you can use the imperative API overrideThemeStyles to directly set/override
styles on a theme:
import Typography from 'typography'
import funstonTheme from 'typography-theme-funston'
funstonTheme.overrideThemeStyles = ({ rhythm }, options) => ({
'h2,h3': {
marginBottom: rhythm(1/2),
marginTop: rhythm(2),
}
})
const typography = new Typography(funstonTheme)
Published Typography.js Themes
- typography-theme-alton
- typography-theme-bootstrap
- typography-theme-de-young
- typography-theme-doelger
- typography-theme-elk-glen
- typography-theme-fairy-gates
- typography-theme-funston
- typography-theme-github
- typography-theme-grand-view
- typography-theme-irving
- typography-theme-judah
- typography-theme-lawton
- typography-theme-legible
- typography-theme-lincoln
- typography-theme-kirkham
- typography-theme-moraga
- typography-theme-noriega
- typography-theme-ocean-beach
- typography-theme-parnassus
- typography-theme-stardust
- typography-theme-st-annes
- typography-theme-stern-grove
- typography-theme-stow-lake
- typography-theme-sutro
- typography-theme-twin-peaks
- typography-theme-us-web-design-standards
- typography-theme-wikipedia
- typography-theme-wordpress-kubrick
- typography-theme-wordpress-2010
- typography-theme-wordpress-2011
- typography-theme-wordpress-2012
- typography-theme-wordpress-2013
- typography-theme-wordpress-2014
- typography-theme-wordpress-2015
- typography-theme-wordpress-2016
- typography-theme-trajan
- typography-theme-zacklive
- typography-theme-anonymous
- typography-theme-domo-arigato - A theme with Roboto fonts
- typography-theme-otis
- typography-theme-quora - theme based on Quora
- typography-theme-vue - inspired by Vue official docs.
- If you publish your own, create a PR to add it here!
Plugins
Plugins are functions that extend or modify the core typography engine.
they can change how headers are styled or add specialized styles e.g.
for code or tables. Currently there's one plugin available,
typography-plugin-code.
To use the Code plugin, first install using NPM.
npm install --save typography-plugin-code
Then add to your theme before creating a new typography object.
import Typography from 'typography'
import CodePlugin from 'typography-plugin-code'
import sternGroveTheme from '
Related Skills
diffs
343.3kUse the diffs tool to produce real, shareable diffs (viewer URL, file artifact, or both) instead of manual edit summaries.
clearshot
Structured screenshot analysis for UI implementation and critique. Analyzes every UI screenshot with a 5×5 spatial grid, full element inventory, and design system extraction — facts and taste together, every time. Escalates to full implementation blueprint when building. Trigger on any digital interface image file (png, jpg, gif, webp — websites, apps, dashboards, mockups, wireframes) or commands like 'analyse this screenshot,' 'rebuild this,' 'match this design,' 'clone this.' Skip for non-UI images (photos, memes, charts) unless the user explicitly wants to build a UI from them. Does NOT trigger on HTML source code, CSS, SVGs, or any code pasted as text.
openpencil
1.9kThe world's first open-source AI-native vector design tool and the first to feature concurrent Agent Teams. Design-as-Code. Turn prompts into UI directly on the live canvas. A modern alternative to Pencil.
HappyColorBlend
HappyColorBlendVibe Project Guidelines Project Overview HappyColorBlendVibe is a Figma plugin for color palette generation with advanced tint/shade blending capabilities. It allows designers to
