-
Couldn't load subscription status.
- Fork 725
Description
As part of the ColorSchemes redesign discussed in
Terminal.Gui’s Attributes (within ColorScheme, proposed to be renamed Scheme) currently only support colors but will soon need to include non-color styles to align with modern terminal capabilities and user expectations. These styles, inspired by PowerShell’s $PSStyle ANSI styles and common terminal features, include Bold, Italic, Underline, Blink, Reverse, Hidden, and Strikethrough. Adding these to Attributes will enable richer visual styling for Terminal.Gui views, support PowerShell-like TUI applications, and align with efforts to honor user terminal settings (#2381).
This issue focuses on extending Attributes to support these non-color styles, keeping #457 as the master issue for the broader ColorSchemes redesign, including naming changes (#4057).
Current State:
Attributes(withinColorScheme) defines foreground and background colors for states like Normal, HotNormal, Focus, HotFocus, and Disabled.- No support exists for non-color styles (e.g., Bold, Italic), limiting Terminal.Gui’s ability to render advanced terminal effects.
- PowerShell’s
$PSStyle(PowerShell 7.2+) supports ANSI styles (Bold, Italic, Underline, Blink, Reverse, Hidden, Strikethrough), which Terminal.Gui should emulate for consistency with user terminal settings.
Proposed Changes:
-
Extend
Attributesstruct:- Define an
enumfor flags for non-color styles:Bold,Italic,Underline,Blink,Reverse,Hidden,Strikethrough. - Add a property for this enum to
Attribute
- Define an
-
Update Rendering:
- Modify Terminal.Gui’s rendering engine to apply these styles using ANSI escape sequences or terminal-specific APIs, leveraging truecolor support (Truecolors (direct RGB colors) support #48).
- Ensure compatibility with terminals supporting 16, 256, or 24-bit RGB colors.
-
Integrate with
Scheme:-
Update
Scheme(orColorScheme, pending RenameColorSchemetoSchemeand MigrateColorstoConfigurationManager.Themes#4057) to use the enhancedAttributesfor all attributes (Normal, HotNormal, Focus, HotFocus, Disabled, Active, HotActive, ReadOnly). -
Example:
var scheme = new Scheme { Normal = new Attribute { Foreground = Color.White, Bold = true }, HotNormal = new Attribute { Foreground = Color.Yellow, Underline = true } };
-
-
Support User Terminal Settings:
- Allow
Attributesto adopt styles from$PSStyle(e.g.,$PSStyle.PSReadLine.Selection’s Reverse style) when querying terminal settings (Attribute System Should honor terminal settings #2381). - Fallback to terminal capabilities (
$TERM) for non-PowerShell environments.
- Allow
-
Accessibility:
- Ensure non-color styles maintain readability (e.g., avoid Blink or Hidden for critical UI elements).
- Enforce contrast for color-based attributes (WCAG 2.1’s 4.5:1 ratio).
Benefits:
- Enables rich styling for Terminal.Gui views, matching modern terminal capabilities.
- Aligns with PowerShell’s
$PSStylefor PowerShell TUI applications. - Supports Attribute System Should honor terminal settings #2381 by allowing Terminal.Gui to reflect user-defined ANSI styles.
- Enhances Master Issue for Updating Color/Attribute System #457’s goal of a flexible, future-proof styling system.
Tasks:
- Define
AttributesAPI for non-color styles (e.g., boolean flags, enum, or bitmask). - Update rendering engine to support Bold, Italic, Underline, Blink, Reverse, Hidden, Strikethrough.
- Integrate enhanced
AttributeswithSchemeattributes (Normal, Active, etc.). - Add support for querying
$PSStyleANSI styles or$TERMcapabilities (Attribute System Should honor terminal settings #2381). - Ensure accessibility with contrast checks and style restrictions.
- Update documentation and samples (e.g., add a styled
TextViewdemo). - Add unit tests for non-color style rendering.
Related Issues:
- Master Issue for Updating Color/Attribute System #457
- Attribute System Should honor terminal settings #2381
- Rename
ColorSchemetoSchemeand MigrateColorstoConfigurationManager.Themes#4057 - Truecolors (direct RGB colors) support #48
Open Questions:
- Which non-color styles are most critical (e.g., prioritize Bold, Italic over Blink)?
- Should
Attributesuse boolean flags, an enum, or a bitmask for styles? - How do we handle terminals with limited style support (e.g., no Italic)?
Community feedback on the proposed styles, API design, and prioritization is welcome!
Metadata
Metadata
Assignees
Labels
Type
Projects
Status