Skip to content

Generate unique(ish) colors for city names using Dopplr's algorithm

Notifications You must be signed in to change notification settings

banterability/blueshift

Folders and files

NameName
Last commit message
Last commit date
May 14, 2019
May 11, 2021
Mar 23, 2020
Aug 19, 2014
May 2, 2022
May 2, 2022
Jun 19, 2018
Jun 19, 2018
May 2, 2022
May 2, 2022
May 2, 2022
Mar 3, 2025
Mar 3, 2025

Repository files navigation

blueshift

Generate unique(ish) colors for city names using Dopplr's algorithm.

Build status Latest published version

About

In 2007, the team at Dopplr posted about their technique for generating colors for cities (linked to the Wayback Machine, because the Internet is cruel).

Here's the relevant bit:

We wanted a deterministic RGB colour value for each city [...] we take the MD5 digest of the city’s name, convert it to hex and take the first 6 characters as a CSS RGB value.

This is that, basically.

Installation

npm install blueshift

Usage

var blueshift = require("blueshift");

blueshift("San Francisco");
// -> '#f4334f'