• Furbag@pawb.social
    link
    fedilink
    English
    arrow-up
    11
    ·
    2 days ago

    I remember typing random combinations of letters and numbers into the hex color field on my marquee span text on my Geocities site when i was a kid and marveling at how it always seemed to yield a different result.

    Anyway, as an edgelord 8 year old with unsupervised access to the internet I discovered that my hexcode is #DEATH or some shit like that, I honestly don’t remember what it was but I was fascinated with the color it produced at the time.

    • humorlessrepost@lemmy.world
      link
      fedilink
      English
      arrow-up
      10
      ·
      2 days ago

      It goes against the spirit of the post, but there was a very detailed system for converting invalid colors to valid ones!

      1. If it exactly matches a recognized named color, use that color.

      2. If it is a valid three-digit legacy hex form such as #abc, expand each digit:

        • a → aa
        • b → bb
        • c → cc
      3. Replace non-BMP characters with 00.

      4. Truncate the value to 128 characters.

      5. Remove a leading #, if present.

      6. Replace every character that is not an ASCII hex digit with 0.

      7. Append 0s until the length is a multiple of three.

      8. Split the result into three equal components for red, green, and blue.

      9. If each component is longer than eight characters, keep only its last eight characters.

      10. Remove leading zeroes from all three components while they remain longer than two characters.

      11. If they are still longer than two characters, truncate each to two characters.

      12. Interpret the three components as hexadecimal numbers and use them as RGB values.