I needed a unique UI color for npubs that's actually readable / usable.

I couldn't find any derivation scheme that gave me colors that work:

- Chat bubble profiles names

- Across themes (Light, Dark, Ivory, Gray, Sepia, ...)

So I thought up the absolute simplest thing that does work:

nostr:naddr1qvzqqqr4gupzp22rfmsktmgpk2rtan7zwu00zuzax5maq5dnsu5g3xxvqr2u3pd7qqxnzde5xcunjv3e8ycrgve5k58fyd

Reply to this note

Please Login to reply.

Discussion

nostr:npub1jlrs53pkdfjnts29kveljul2sm0actt6n8dxrrzqcersttvcuv3qdjynqn how do you currently pick chat bubble colors in Flotilla?

Just 15 or so hardcoded colors: https://github.com/coracle-social/flotilla/blob/68ebd32e1500bc5a6ac9f5e23c3ed66ea25ca55d/src/app/state.ts#L123

I've used HSL in the past, but never was very happy with the results

Give the spec I wrote a shot.

https://jsfiddle.net/rq58zgn4/

The first color I see is unfortunately not usable in Light mode.

The one for my own pubkey, neither.

Also, why not use the full HEX pubkey to avoid weird or repeating colors with mined keys etc?

Nostrudel does this

Nostrudel takes first 6 chars of HEX pubkey.

Not usable.

You should be aware of the considerable discussion around nostruel's profile color derivation because of the security UX pitfalls it introduces. It was informative. I don't remember when it happened but if you're serious about this color thing it would be an oversight to disregard.

Mmm ok. If you're deriving from a private key maybe?

Because:

- reading your npub

- formatting it as an `ìnt`

- making that `int`determine your color Hue

... is quite innocent tbh.

Npub, not pubkey should be the input

Yes. It is the npub. I have to rename the variable. I

Why hash it and add extra computation?

Is there anything wrong with just using the `Int` of the npub and doing the modulus on that?

Also, not all hues pop-off the screen in the same way:

- yellow-green range pops more

- purple pops less

That's why I adjust slightly for that.

Plus it gives me the same colors that work in both Light and Dark mode.

But if we could just already agree on a way to determine Hue, I'm a happy man.