Jan De DobbeleerandJan De Dobbeleer 5f2e723a6d feat(color): auto-shade single-color gradients with dark-gradient/light-gradient
A single-color gradient effect for segments too narrow for a real
two-stop gradient to render as anything but a solid color:
dark-gradient(#color) runs from that exact color to a darker
shade, light-gradient(#color) to a lighter one.

The shade drops (or raises) HCL lightness only, by a fraction of
the base color's own headroom toward the target end, keeping hue
exact and walking chroma down only as far as the sRGB gamut
forces - blending toward black/white directly pulls chroma down
with it, reading as the color going muddy rather than
deepening/brightening. The reference delta is tuned so a 3-cell
segment - the common case this exists for - lands its shade close
to a just-noticeable-difference rather than a hard color swap; a
width multiplier grows that delta for wider segments as a
saturating curve (not linear growth with a hard clamp - that hit
its clamp by ~15-20 cells and crushed every wider segment to the
exact same near-white/near-black color, which is what "the
gradient stops working on a larger segment" turned out to be),
so a very wide segment still shades further than a moderately
wide one while topping out at a moderate, recognizably-still-the-
same-hue color instead of washing out to white or black.

GradientLastForCells mirrors the same shading (for a given cell
count) on the raw stop text, so powerline separators, diamond
caps, and inline color-override edges (via a new
gradientRenderCells package var in the terminal writer) line up
with the color the body actually ends on for that segment's own
width. GradientLast (no cell count - used by parentBackground/
parentForeground crossing into another segment, and wherever
width isn't known) falls back to the narrowest, gentlest shade.

WithGradientStops rebuilds a gradient string keeping its own
prefix (linear-gradient, dark-gradient, or light-gradient), so
resolving a palette-referenced stop (dark-gradient(p:teal)) keeps
its darken semantics instead of silently becoming a plain
linear-gradient - whole-string palette resolution only ever
expanded a bare "p:name" that itself resolved to a gradient,
never a "p:name" used as one stop inside a gradient literal, so a
palette-referenced stop reached GradientLast unresolved and fell
back to the raw, unshaded base color.

linear-gradient itself goes back to requiring two or more stops;
the single-stop overload it briefly had is now dark-gradient's job.

Entire-Checkpoint: 85522027570b
2026-07-24 14:33:13 +02:00
2026-07-10 16:43:37 +02:00
2025-09-11 11:23:29 +02:00
2026-07-13 16:30:38 +02:00
2024-09-19 08:29:35 +02:00
2026-02-16 16:26:51 +01:00
2026-07-17 13:47:33 +02:00
2026-07-15 09:05:39 +02:00
2022-02-28 07:48:03 +01:00
2023-10-05 11:41:05 +02:00

Oh My Posh logo – Prompt theme engine for any shell

MIT license badge

Build Status badge

Release version number badge

Documentation link badge ohmyposh.dev

Number of GitHub Downloads badge

This repo was made with love using GitKraken.

GitKraken shield

Sponsors

CodeRabbit J

Want to become a sponsor?

Join the community

Mastodon badge

Discord badge

What started as the offspring of oh-my-posh2 for PowerShell resulted in a cross platform, highly customizable and extensible prompt theme engine. After 4 years of working on oh-my-posh, a modern and more efficient tool was needed to suit my personal needs.

❤️ Support ❤️

Swag - Show your love with a t-shirt!

GitHub - One time support, or a recurring donation?

Ko-Fi - No coffee, no code.

Features

  • Shell and platform agnostic
  • Easily configurable
  • The most configurable prompt utility
  • Fast
  • Secondary prompt
  • Right prompt
  • Transient prompt

Documentation

Documentation

Reviews

Thanks

S
Description
The most customisable and low-latency cross platform/shell prompt renderer
Readme
159 MiB
Languages
Go 66.1%
MDX 19.2%
JavaScript 9%
PowerShell 2%
Shell 1.7%
Other 1.7%