erming / shout

Deprecated. See fork @ https://github.com/thelounge
MIT License
3.62k stars 272 forks source link

Make colored nicknames look good with any background #363

Open crazy2k opened 9 years ago

crazy2k commented 9 years ago

Current template sets the nickname color using Handlebars' stringcolor helper. This helper uses the stringcolor() function in client/js/libs/stringcolor.js which ends up calling string_to_color(). There's a shade() function defined in there that allows for darkness/lightness to be altered. However, the value for that is fixed/hardcoded to -10.

It's easy to manually change that number to something more suitable to the theme we're currently using. In my case, since I'm using zenburn.css, I can change that -10 to something higher so that nicknames look brighter. However, it'd be better to have this value a) adjusted automatically so that it plays well with the current background, or b) set by the theme itself (which now is just a CSS file, so probably this would require changes in the theming mechanism).

How do you think would be the best way to implement this?

crazy2k commented 9 years ago

Any comments?

deejayy commented 9 years ago

I use an algorhitm in one of my projects, as of:

You must know the background's type, of course.

erming commented 9 years ago

Hello! Sorry for the late reply.

Anyway. Maybe it's a better idea to use colors set by the theme, as you suggest. Instead of just randomly selecting a funky color, it could use:

.color-1 {}
.color-2 {}
.color-3 {}
// etc...

I'll see what I'll do about it. I'll ping this thread if there's any news.