• Stars
    star
    166
  • Rank 227,748 (Top 5 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 1 year ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Harmony color palette

Harmony

Harmony: Accessible UI Color Palette

The Harmony palette is designed to elevate control over color contrast in your design system.

  • Uses OKLCH and APCA for highly consistent color shades
  • Has P3 options for modern screens
  • Created to keep 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);
}

Harmony also provides an index.css file that imports all other css files. 👮WARNING: this file is huge and should be used only in combination with PurgeCSS (with variables option enabled), other tools that can clean unused css variables, or if you really need all the colors.

@import '@evilmartians/harmony/css/index.css

/* now you can use any color */
h1 {
  color: var(--orange-600);
}

h2 {
  color: var(--red-300);
}

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)

More Repositories

1

lefthook

Fast and powerful Git hooks manager for any type of projects.
Go
4,901
star
2

mono

Free and open-source monospaced font from Evil Martians
2,122
star
3

oklch-picker

Color Picker for LCH
TypeScript
757
star
4

terraforming-rails

Terraforming legacy Rails applications guides and tools
Ruby
731
star
5

evil-seed

A Gem for creating partial anonymized dumps of your database using your app model relations.
Ruby
451
star
6

ruby-on-whales

Ruby on Whales example and templates
Ruby
286
star
7

fullstaq-ruby-docker

Docker image for Ruby build from Fullstaq packages based on Debian 10, 11, and 12.
Dockerfile
176
star
8

evil-client

Human-friendly DSL for writing HTTP(s) clients in Ruby
Ruby
104
star
9

activerecord-slotted_counters

Active Record extension providing slotted counters support
Ruby
102
star
10

fias

Ruby wrapper for the Russian FIAS database (Федеральная Информационная Адресная Система)
Ruby
82
star
11

chronicles-gql-martian-library

Ruby
71
star
12

chef-kubernetes

Google Kubernetes installer for ubuntu >= 16.04
Ruby
69
star
13

figma-polychrom

Figma plugin for displaying the contrast level and font size recommendations according to the APCA method
TypeScript
67
star
14

liquor

Liquor is a safe sandboxing compiling template language for Ruby
Ruby
59
star
15

graphql-connections

Additional implementations of cursor-based paginations for GraphQL Ruby gem.
Ruby
45
star
16

evil_chat

Code for "Evil Front: Modern Front-end in Rails" 3-part tutorial: https://evilmartians.com/chronicles/evil-front-part-1
Ruby
41
star
17

chef-prometheus-exporters

Ruby
38
star
18

chef-nginx

Chef Nginx recipes
Ruby
35
star
19

telephony

Evil Martians' telephony application that run our phone numbers
JavaScript
30
star
20

capybara-thruster

Thruster server definition for Capybara
Ruby
29
star
21

foundry

Foundry Compiler
OCaml
24
star
22

rubocoping-generator

Ruby application template to configure RuboCop with Standard and plugins
Ruby
15
star
23

furnace-xray

A visualizer for transformations of code in Static Single Assignment form based on the Furnace library.
CoffeeScript
11
star
24

cupid

Create, organize and send emails through ExactTarget SOAP API
Ruby
10
star
25

redis-proxy

Redis Proxy
Go
9
star
26

evil-struct

Nested structure with type constraints, based on the `dry-initializer` DSL
Ruby
9
star
27

omniauth-ebay-oauth

OmniAuth Strategy for eBay Apps (for using with eBay REST APIs)
Ruby
7
star
28

zendesk

Proper Ruby wrapper around the Zendesk API
Ruby
6
star
29

astro-typedoc

A tool for building astro-based documentation sites using Typescript types definitions and TSDocs.
JavaScript
6
star
30

catalyst-tutorial

Beyond Fashion Deep Learning With Catalyst post code
Python
6
star
31

monstro

Cult of Martians screensaver
Objective-C
5
star
32

foundry-lib

Foundry standard library and examples (public)
Fancy
5
star
33

github-tv

Forks your colleagues' open-source repos to your organization page
Ruby
4
star
34

chef-mdadm

mdadm recipe
Ruby
4
star
35

amplifr-node

JavaScript
3
star
36

homebrew-lefthook

Homebrew Formulae to lefthook
Ruby
2
star
37

kibana-logtrail

Kibana docker image with logtrail plugin.
Dockerfile
2
star
38

helm-kubectl-docker

Dockerfile
2
star
39

docker-curl

A simple docker image which contains curl (based on Alpine linux)
Dockerfile
1
star
40

charts

Public Helm charts
Smarty
1
star
41

foundry-web

Foundry website
JavaScript
1
star
42

gcloud-helm-docker

Deploy image for GKE with Helm & kubectl binaries.
Dockerfile
1
star
43

chef-consul-wrapper

Ruby
1
star
44

elasticsearch-k8s

1
star