Skip to content

Add dynamic color feature based on widget values #38

Open

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.

Activity

  1. sirmalloc commented on Aug 20, 2025

    @sirmalloc
    Owner

    I definitely like the concept. Are you thinking for certain widgets that support dynamic color that this would be on by default?

    There's a lot of things to take into consideration with how the colors currently work. We've got the ability for global BG and FG overrides, powerline theme overrides, and custom color overrides (both in powerline and non-powerline modes). There's also merged items that get their background color from the item they are merged with.

    If we can find a system that plays well with all these, I'd love it. If you want to take a stab at implementing it, please feel free. I don't have any major changes planned for the next few days that'll disrupt the touchpoints that this would need.

  2. mrclrchtr commented on Aug 20, 2025

    @mrclrchtr
    Author

    I'm currently working on a few adjustments that I definitely want to have for myself. Among other things, I'm trying to refine the themes a little:

    Image Image

    (And added other "Block" options)

    I will take a close look at this and think I will find a good solution.

    Thanks in advance for the insights!

  3. sirmalloc commented on Aug 20, 2025

    @sirmalloc
    Owner

    Very cool, and I definitely welcome the contribution. I'm colorblind (protanopia) so most of these themes were claude generated and then lots of back and forth to ensure some minimum contrast level and ensure they work in all color modes. Just make sure on the powerline themes that they handle wraparound properly - last color has enough contrast with the first color for statuslines that have enough widgets to wraparound the theme. And make sure to test in 16 / 256 / true color modes. It's a pain but I want it to look good for everyone no matter how they are using it.

    I like the icons, I'd just say make it a toggleable thing. I had an enhancement issue planned to make the labels customizable for each item, so my thought was if someone wants an emoji or unicode symbol instead of text, we'd just let them customize the label. Just keep in mind the config file migration if there are any breaking changes, I don't want to break anyone's existing layout. If you want to go over anything in more detail, you can usually find me on Discord. There's also a new widget metadata storage system I want to migrate everything to, giving it a space in the config for a key/value store per widget instead of how most of them work now. I can discuss that in more detail if you want to chat sometime.

  4. ekain-fr commented on Nov 23, 2025

    @ekain-fr

    Hello, I'd also like to see this feature integrated. Would be very useful at least for context and usage metrics. Did you make any progress on implementing this feature?

  5. sirmalloc commented on Nov 28, 2025

    @sirmalloc
    Owner
  6. added a commit that references this issue on Jan 31, 2026
    12f0d45
  7. added a commit that references this issue on Mar 14, 2026
    96fa188
  8. chrisbeardy commented on May 21, 2026

    @chrisbeardy

    +1 for this, I would love to have my context window bar change colour as my context goes up to remind me that i may want to compact before it auto compacts. Additionally an icon that could conditionally appear (and or flash) too based on my context level would also be great.

  9. mdefeche commented on Jun 3, 2026

    @mdefeche

    I would also love to have this for the session usage before I start using $ from extra usage !

  10. xkrt commented on Jul 17, 2026

    @xkrt

    I would love to have an option for auto-switch colors for model names and effort-levels.
    Also, it would be nice if Git Changes like (+42,-10) were colored as +42 green and -10 red.

  11. eric-engberg commented on Oct 9, 2026

    @eric-engberg
    Contributor

    Value colors are built in my fork, per widget, with break points you can edit or a gradient:

    From this thread, model names and effort levels are eric-engberg#40 and eric-engberg#2. Coloring Git Changes' +/- isn't covered. None of it is upstream yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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