← Back to Home • Next:
ChartBar paints its output in named regions. Each region is a ChartBarStyles value you can
recolor per control instance.
ℹ️ Styling is per control — there is no global “style all charts” API. The only style-related global setting is
PromptPlus.Config.ContrastRatio.
ChartBarStyles regions| Region | What it paints |
|---|---|
Prompt |
The prompt text |
Error |
The validation error line |
Selected |
The highlighted / current chart item |
ChartLabel |
The item labels |
ChartValue |
The numeric values |
ChartPercent |
The percentage values |
ChartTitle |
The chart title (Title) |
Answer |
The confirmed answer shown after .Run() |
Pagination |
The page indicator |
Use the fluent Styles method. A Style is a foreground color, a background
color, and an Overflow strategy — there is no bold/italic/underline. A bare Color is accepted
as shorthand for a foreground-only style.
using ConsolePlusLibrary;
using PromptPlusLibrary;
PromptPlus.Controls
.ChartBar("Select item")
.AddItem("North", 120).AddItem("South", 80).AddItem("East", 95)
.Title("Sales by Region")
.Styles(ChartBarStyles.ChartTitle, Color.Yellow)
.Styles(ChartBarStyles.ChartPercent, Color.Cyan)
.Styles(ChartBarStyles.Selected, new Style(Color.Blue, Color.Default))
.Run();
To reuse a theme across charts, wrap the styling in a helper you call for each control — the library does not broadcast styles for you. See Global Styles for the pattern.
Bar colors themselves come from
AddItem’scolorBarargument (or the automatic rotating sequence), not fromChartBarStyles. UseStylesfor the labels, values, percentages, title, and other text regions.
PromptPlus nudges foreground colors that fall below the configured contrast ratio so text stays
readable on any terminal theme. Tune or disable with PromptPlus.Config.ContrastRatio.
Style type, per-control styling, contrastStyle API and Overflow