A lightweight toolset for writing styles in JavaScript

View on GitHub Docs

Installation

npm install --save polished

Usage

import { lighten, modularScale } from 'polished'

Open the console and play around with it!

const styles = {
  color: lighten(0.2, '#000'),
  "font-size": modularScale(1),
  [hiDPI(1.5)]: {
    "font-size": modularScale(1.25)
  }
}
const styles = {
  color: '#333',
  "font-size": '1.33em',
  '@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min--moz-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 1.5/1), only screen and (min-resolution: 144dpi), only screen and (min-resolution: 1.5dppx)': {
    "font-size": '1.66625em',
  }
}