NIPs by PolleramaCommunity NIPs, surfaced by trustConnect
npub1543u4xsk6az...

Profile Colors

Published May 1, 2026
kind 0

NIP-XX

Profile Colors

draft optional ui

A standard for deriving deterministic, readable colors from Nostr pubkeys. This ensures consistent visual identity across all clients.

Abstract

Nostr apps often use random colors for default avatars, profile names, and chat bubbles. This NIP proposes deriving a unique, consistent color from each user's pubkey instead — one that is readable in both light and dark modes, and avoids grays.

Motivation

Currently, clients generate profile colors inconsistently. Different algorithms produce different colors for the same pubkey, fragmenting the user experience.

Standardizing pubkey-derived colors:

  • Ensures consistent identity across all clients
  • Provides predictable, reproducible colors
  • Works as text, background, border, or indicator dot without extra UI elements

Color Derivation

Algorithm

  1. Convert the 64-character hex pubkey to an integer
  2. Calculate the Hue: integer % 360
  3. Set Saturation to 70%
  4. Set Value/Brightness based on Hue range:
Hue RangeBrightness
32–20475%
216–27396%
Otherwise90%
  1. Convert HSV to the desired format (RGB, Hex, HSL, etc.)

Text Readability

When using the profile color for text (author names, mentions, etc.), adjust brightness:

  • Dark mode: increase brightness by +8%
  • Light mode: decrease brightness by -5%

This ensures readable text in both modes without runtime luminance calculations.

Example

Given pubkey a1b2c3d4e5f6...:

  1. Convert to integer: 461184877...
  2. Hue: 461184877 % 360 = 197
  3. Saturation: 70%
  4. Hue 197 is in range 32–204 → Brightness: 75%
  5. HSV(197, 70%, 75%) → RGB

Client Behavior

Clients SHOULD:

  • Use the derived color for default avatars, profile names, and indicators when no profile picture is available
  • Apply text brightness adjustments for the current theme (light/dark)
  • Support the color as background, text, border, or dot indicator

Clients MAY:

  • Use the color as a placeholder while loading a profile picture
  • Use the color as fallback if the profile picture URL fails to load