Skip to content

Add dynamic color feature based on widget values #38

@mrclrchtr

Description

@mrclrchtr

Feature Request: Dynamic Color Based on Widget Values

Add support for widgets to dynamically change color based on their current value ranges.

Example Use Case

Context percentage widgets that change color based on usage:

  • Low usage (0-50%): Green
  • Medium usage (50-80%): Yellow
  • High usage (80-100%): Red

Current State

Widgets currently use static colors defined in getDefaultColor() method or user-configured colors. The color system supports:

  • Static widget colors via getDefaultColor()
  • User overrides via color property
  • Global color overrides
  • Powerline theme colors

Proposed Solution

Add optional dynamic color capability to Widget interface:

  1. New optional method getDynamicColor(value, item, context, settings)
  2. Fallback to existing static color system when not implemented
  3. Configuration for color thresholds/ranges per widget type
  4. Support for both foreground and background dynamic colors

Benefits

  • Visual feedback for important metrics (context usage, token limits)
  • Improved at-a-glance status recognition
  • Maintains backward compatibility with existing configurations

Implementation Considerations

  • Should respect user color overrides and global settings
  • Work with both regular and powerline rendering modes
  • Consider terminal color capability (16/256/truecolor)
  • Allow configuration of thresholds per widget instance

I would like to work on this, if you want to.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions