From 264367cef14bcb4f17c143b2377affe1cfd8680f Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 25 Jan 2025 15:30:29 -0500 Subject: [PATCH] more drafting --- .../posts/mapping-strings-to-rgb-colors/_index.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/content/posts/mapping-strings-to-rgb-colors/_index.md b/content/posts/mapping-strings-to-rgb-colors/_index.md index edba8b3..aee218f 100644 --- a/content/posts/mapping-strings-to-rgb-colors/_index.md +++ b/content/posts/mapping-strings-to-rgb-colors/_index.md @@ -16,7 +16,20 @@ showFullContent: false {{< lead >}} {{ }} ## The Plan -- +- Take an arbitrary UTF-8 string +- Generate an RGB or RGBA color code for it in a deterministic way + - SHA1 the string + - Interpret equally sized chunks of the hash as integers + - Scale those integers into an 8-bit space ## The Implementation ## The Results +Below is a sample of the "lorum ipsum" text with each word colored using this algorithm. + +

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

+ + + ## Possible Improvements +- Provide HSV or HSL color values +- Light/dark mode awareness +- Accessibility. The colors chosen are effectively random with no regard for color schemes, background, display device capability