Cameek.GreenScreen
0.0.1
See the version list below for details.
dotnet add package Cameek.GreenScreen --version 0.0.1
NuGet\Install-Package Cameek.GreenScreen -Version 0.0.1
<PackageReference Include="Cameek.GreenScreen" Version="0.0.1" />
<PackageVersion Include="Cameek.GreenScreen" Version="0.0.1" />
<PackageReference Include="Cameek.GreenScreen" />
paket add Cameek.GreenScreen --version 0.0.1
#r "nuget: Cameek.GreenScreen, 0.0.1"
#:package Cameek.GreenScreen@0.0.1
#addin nuget:?package=Cameek.GreenScreen&version=0.0.1
#tool nuget:?package=Cameek.GreenScreen&version=0.0.1
Cameek.GreenScreen
Cameek.GreenScreen is a lightweight .NET 8 terminal UI and PTY framework. It provides a full-screen ScreenBuffer renderer, ANSI color fallback from truecolor down to ANSI16, byte-stream input parsing, Linux PTY process hosting, and best-effort overlays for interactive terminal processes.
Package status: 0.0.1 proof-of-concept and not yet published. When published, installation is expected to look like:
dotnet add package Cameek.GreenScreen
Scenarios
- Full-screen terminal UIs with controls such as panels, labels, buttons, dialogs, menus, text boxes, progress bars, status bars, and log views.
- Local terminal rendering over ANSI escape sequences.
- SSH and container terminal sessions where capability detection can be overridden.
- Interactive PTY-hosted child processes with argument arrays, working directories, environment overrides, resize, output reads, input writes, exit codes, and lifecycle control.
- Best-effort floating overlays over PTY output without injecting bytes inside UTF-8 or terminal control sequences.
- Right-aligned menu bars and mirrored left-expanding submenu trees for compact top-right controls.
- Future external applications that need to compose terminal UI, PTY execution, direct input routing, and overlay suspension without adding workflow-specific code to this library.
Colors
The public drawing model uses TerminalColor instead of ConsoleColor. It supports terminal default colors, ANSI16 colors, indexed 256-color values, and 24-bit RGB truecolor.
buffer.SetHalfBlock(
x,
y,
TerminalColor.Rgb(255, 80, 20),
TerminalColor.Indexed(45));
AnsiTerminalOptions.ColorMode can be set to Auto, TrueColor, Indexed256, or Ansi16. Auto mode uses conservative environment hints such as COLORTERM=truecolor and TERM=*256color; explicit configuration always wins.
PTY Hosting
Use PtyProcess for generic child processes. Arguments are passed as an array and are not concatenated through a shell unless you explicitly start a shell yourself.
using var process = PtyProcess.Start(new PtyProcessStartInfo
{
FileName = "sudo",
Arguments = { "apt", "install", "kubectl" },
WorkingDirectory = Environment.CurrentDirectory,
InitialSize = new Size(120, 32)
});
process.Write("y\n"u8.ToArray());
var exitCode = await process.WaitForExitAsync();
ShellOverlayApplication remains as a convenience shell overlay demo API, but it now sits on top of the generic PTY process layer.
PTY support in this alpha is implemented and tested for Linux. Windows ConPTY and macOS backends are not implemented yet. The task-based ReadAsync and WriteAsync helpers are convenience wrappers over blocking PTY operations; cancellation prevents starting queued work but does not guarantee interruption after the native operation has begun.
Interactive full-screen and host modes require successful raw/no-echo terminal setup. If the original terminal state cannot be captured or raw mode cannot be activated, GreenScreen fails fast instead of continuing in canonical or echoing mode.
Overlays
Overlays are best-effort. GreenScreen tracks PTY output boundaries so it does not inject overlay bytes inside UTF-8 code points, CSI, OSC, DCS, or related string sequences. Overlay changes are versioned, prepared, deferred until a safe child-stream boundary, and committed only after their bytes are written; older commits do not erase newer redraw requests. A replacement draw first clears the previously committed overlay geometry, then draws the new overlay, and then commits the new clear bytes and hit regions. Mouse hit testing follows immutable hit regions from the last committed visible overlay snapshot. It also restores common SGR text attributes after drawing overlays.
This does not make an overlay a protected graphical layer. Full-screen child applications can clear or redraw the same screen area. Suspend overlay rendering for programs such as editors, pagers, nested SSH sessions, and full-screen installers.
InteractiveProcessHost.SuspendOverlay() exposes a scoped public rendering suspension mechanism. It pauses and clears overlay rendering while the scope is alive; draw requests may coalesce while suspended, and the latest state redraws when the outermost scope is disposed. It is not a transparent input handoff mode: normal host input routing and configured mouse forwarding still apply.
The input parser maps common keyboard, mouse, CSI, and SS3 sequences to TerminalInputEvent. Unsupported but syntactically complete terminal control sequences are consumed safely and ignored rather than leaking trailing bytes as typed text.
Menus
MenuBar supports explicit nested submenu activation. Moving selection with Up/Down does not open child menus; branch items show a directional indicator and open with the expansion-direction arrow, Enter, or Space. MenuBar.Alignment = MenuBarAlignment.Right right-aligns top-level items, and SubmenuDirection = SubmenuExpansionDirection.Left creates mirrored left-expanding submenu trees for compact controls near the right edge.
Unicode
Text rendering uses grapheme enumeration for WriteText and preserves selected wide glyph behavior such as emoji and half-block graphics. It is not a complete Unicode terminal-width engine. CJK width, combining marks, variation selectors, zero-width joiners, and East Asian ambiguous width should be treated as alpha limitations. TextBox editing currently uses UTF-16 string indexes and is optimized for typical Latin input.
Examples
Cameek.GreenScreen.ExampleApp- first interactive UI demo.Cameek.GreenScreen.ExampleApp2- IDE-style viewer demo.Cameek.GreenScreen.ExampleApp3- editable IDE-style demo.Cameek.GreenScreen.ExampleApp4- shell overlay with clickable macro buttons.Cameek.GreenScreen.ExampleApp5- experimental framed embedded shell surface, not a complete terminal emulator.Cameek.GreenScreen.ExampleApp6- JSONL progress/event prototype kept outside core.Cameek.GreenScreen.ExampleApp7- truecolor half-block graphics demo with mode fallback switching.Cameek.GreenScreen.ExampleApp8- generic PTY and overlay fragmentation stress lab.Cameek.GreenScreen.ExampleApp9- real PTY shell with a compact top-right framed menu overlay and left-expanding nested menus.
Run the full-screen truecolor demo:
dotnet run --project Cameek.GreenScreen.ExampleApp7
Run the PTY stress lab:
dotnet run --project Cameek.GreenScreen.ExampleApp8
Run the generic shell-host mode:
dotnet run --project Cameek.GreenScreen.ExampleApp8 -- --shell
Run the compact framed PTY menu demo:
dotnet run --project Cameek.GreenScreen.ExampleApp9
Build, Test, Pack
dotnet build Cameek.GreenScreen.sln
dotnet test Cameek.GreenScreen.sln
dotnet pack Cameek.GreenScreen/Cameek.GreenScreen.csproj -c Release
Release scripts live in .scripts. Use .scripts/tag-latest-version.sh to tag
the current version, or .scripts/increase-and-tag-version.sh --patch to bump,
commit, push, and tag. Pushed vA.B.C tags trigger NuGet publishing.
Platform-specific PTY tests are written to pass without requiring root or sudo and skip their body when PTY support is unavailable.
Documentation
See:
docs/architecture.mddocs/terminal-colors.mddocs/pty.mddocs/overlays.mddocs/compatibility.mddocs/manual-smoke-test.md
License
Licensed under the MIT License. See the LICENSE file for full details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Cameek.GreenScreen:
| Package | Downloads |
|---|---|
|
Cameek.Run67.Tool
Human-first terminal workflow runner with planning, approvals, durable Run Records, interactive terminal execution, and resume support. |
|
|
Cameek.GreenScreen.Images
Optional PNG image support for Cameek.GreenScreen. |
GitHub repositories
This package is not used by any popular GitHub repositories.