Skip to content

Commit

Permalink
update docs and bump
Browse files Browse the repository at this point in the history
  • Loading branch information
loucadufault committed Jan 7, 2022
1 parent 27acf31 commit f39b334
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/public/README.template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ A lightweight package to generate unique and uniformly sampled colors from UUIDs

The RGB color space is represented and spanned by hexadecimal numbers in the 0x000000 to 0xffffff range. We can use a simple modulo hash function (`% (0xffffff + 0x000001)` i.e. `% 0x100000`) to return numbers in that range from the decimal representation of the UUID (a base 10 39-digit integer). We then extract the red, green, and blue components from the resulting hash (which represents a specific color in hexadecimal notation) using bit masks.

Since the color space is only 255^3 whereas the UUID space is much larger (5.3 x 10^36 possible UUIDs), it is impossible to create a complete bijection, and collisions in the generated color space are more likely to happen.
Since the color space is only 255^3 whereas the UUID space is much larger ([approximtely 5.3 x 10^36 possible UUIDs](https://www.uuidtools.com/what-is-uuid#overview)), it is impossible to create a complete bijection between the spaces, and so collisions in the generated color space are more likely to happen. This package does guarantee that the color space is maximally utilized, assuming a uniform distribution of the input UUIDs in the UUID space.

# Installation:

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "uuid-color",
"version": "0.0.1",
"version": "0.0.2",
"description": "A lightweight package to generate unique and uniformly sampled colors from UUIDs.",
"main": "lib/index.js",
"scripts": {
Expand Down

0 comments on commit f39b334

Please sign in to comment.