Skip to the content

Low Code Life

Hacking away unnecessary LOCs since 1980.


Generating unique, contrasting colors in JavaScript

Author: smeans
Date: 2021-02-14
Tags: BitTwiddling, CSS, JavaScript
Categories: Useful Code

Coming up with contrasting, attractive colors for an unknown number of items can be tricky. This post gives a short (10 line) function that returns unique colors for an arbitrary number of items using bit manipulation.


Recent Posts

  • Generating unique, contrasting colors in JavaScript
  • A beautiful gem of code from the Python docs.
  • A 42-line JSON template engine.

Recent Comments

    Archives

    • February 2021
    • January 2021

    Categories

    • Beautiful Code
    • Useful Code

    Meta

    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org
    © 2021 Low Code Life. All rights reserved. Powered by WordPress.