gundb / gatling

Chat system based on GUN
19 stars 7 forks source link

Colorize #2

Open metasean opened 8 years ago

metasean commented 8 years ago

Modify colorize to account for different users with same/similar names.

metasean commented 8 years ago

Goals

  1. The goal of colorize is to provide deterministic, mostly distinct coloration of usernames and messages (similar to hash-generated gravatars, albeit without any allusions of uniqueness).
  2. It would be nice if the distinct coloration could be overridden on a site-specific level (e.g. for theming purposes)

Areas for Improvement

  1. The generated "color" is currently based just on a 3-32 char username. Multiple people can use the same or similar names. It would be better if we included some other piece of deterministic information to generate slightly more distinct coloration (e.g. http://jsbin.com/gahigi/edit?html,output).
  2. It would be nice to have an easy way to change the hue, saturation, value, & alpha programmatically to approximate theming (e.g. http://jsbin.com/davima/edit?html,js,output)
  3. It may be more optimal to add CSS rules instead of inlining the actual colors (http://stackoverflow.com/questions/31038227/browser-inconsistency-when-using-javascript-to-generate-javascript-to-generate-i?noredirect=1#comment50100421_31038227)

See also - http://devmag.org.za/2012/07/29/how-to-choose-colours-procedurally-algorithms/