Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@evilmartians/harmony

Package Overview
Dependencies
Maintainers
6
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@evilmartians/harmony

![Harmony](cover.png)

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
145
decreased by-24.48%
Maintainers
6
Weekly downloads
 
Created
Source

Harmony

Harmony: Accessible UI Color Palette

The Harmony palette is designed to elevate control over color contrast in your design system. With the OKLCH color space and the innovative APCA contrast algorithm, Harmony offers highly consistent color shades, previously unavailable P3 gamut colors, and precise control over text and UI element contrast.

  Made by Evil Martians, product consulting for developer tools.

Features

  • Equal contrast within lightness groups
  • Mirrored contrast pairs
  • Contrast levels for readability
  • Tailwind compatibility
  • P3 gamut for maximum color

Installation

npm install @evilmartians/harmony

Usage with Tailwind

Harmony can work as drop-in replacement for the Tailwind color palette:

// tailwind.config.js

import harmonyPalette from "@evilmartians/harmony/tailwind";

export default {
  theme: {
    colors: harmonyPalette,
  },
  //...
};

⚠️ Harmony uses oklch colors and so requires a polyfill for old browsers

  1. Install PostCSS plugin that polyfills oklch colors
npm install -D @csstools/postcss-oklab-function
  1. Enable it in postcss.config.js:
export default {
    plugins: {
        tailwindcss: {},
+        '@csstools/postcss-oklab-function': { 'preserve': true },
        autoprefixer: {},
    },
}

Vanilla CSS

Harmony palette provides a set of files with css variables. Each file contains all shades for one color in OKLCH with RGB fallbacks for old browsers. Just import colors you need and use them in css:

@import '@evilmartians/harmony/css/orange.css';

h1 {
  color: var(--orange-600);
}

Other formats

Plain javascript object with colors without tailwind's specifics can be imported from @evilmartians/harmony/base

import palette from "@evilmartians/harmony/base";
console.log(palette.red["50"]); // => oklch(0.988281 0.0046875 20)

Keywords

FAQs

Package last updated on 09 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc