NeoKolors.Tui 2026.4.0-preview.4

This is a prerelease version of NeoKolors.Tui.
dotnet add package NeoKolors.Tui --version 2026.4.0-preview.4
                    
NuGet\Install-Package NeoKolors.Tui -Version 2026.4.0-preview.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NeoKolors.Tui" Version="2026.4.0-preview.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NeoKolors.Tui" Version="2026.4.0-preview.4" />
                    
Directory.Packages.props
<PackageReference Include="NeoKolors.Tui" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NeoKolors.Tui --version 2026.4.0-preview.4
                    
#r "nuget: NeoKolors.Tui, 2026.4.0-preview.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NeoKolors.Tui@2026.4.0-preview.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NeoKolors.Tui&version=2026.4.0-preview.4&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=NeoKolors.Tui&version=2026.4.0-preview.4&prerelease
                    
Install as a Cake Tool

NeoKolors.Tui

Build & Test NuGet Version NuGet Downloads License

NeoKolors.Tui is a state-driven, component-oriented Text User Interface (TUI) framework for .NET. It provides double-buffered canvas rendering, flexible layout panels, responsive borders, interactive mouse support, and modular application and game lifecycle engines.


Modular Architecture

The TUI ecosystem is divided into focused modules:

  • NeoKolors.Tui.Core: Double-buffered NKCharCanvas and NKCharScreen, diff-based ANSI flusher, custom border styling (NKBorderStyle), cell layering (ZLayers), profiler, and spatial hit-maps (HitMap).
  • NeoKolors.Tui.Elements: Component tree featuring Flex, Grid, Table, Border, Button, List, Text, and mouse event routing (ElementsMouseDispatcher).
  • NeoKolors.Tui.Lifecycle.Core: Engine foundation with ILifecycle, LifecycleController, FrameClock, FixedTimestepAccumulator, DeltaTime, and SceneStack.
  • NeoKolors.Tui.Lifecycle.Apps: Application hosting infrastructure with AppLifecycleHost, NKAppView, activation state tracking, and throttled/lazy rendering loops.
  • NeoKolors.Tui.Lifecycle.Game2D: 2D arcade terminal game loop, 2D camera viewport, and multi-stage rendering pipelines.
  • NeoKolors.Tui.Lifecycle.Game3D: 3D terminal graphics lifecycle abstractions and architecture plans.
  • NeoKolors.Tui.Fonts: Dynamic typography engine supporting XML V3 definitions, MessagePack binary .nkf compilation, Figlet fonts, and font assets.
  • NeoKolors.Tui.Widgets: Standalone console widget controls.

Core Features

  • Zero-Flicker Diff Rendering: NKCharScreen maintains front and back character buffers. When Render() executes, only changed character cells, foreground/background colors, and style attributes are converted to ANSI sequences, drastically reducing terminal I/O latency and eliminating screen flicker.
  • Declarative Layout Trees: Compose views using Flex (row/column orientation, justify content, align items, flex wrapping, gap spacing) and Grid (multi-row and multi-column tabular arrangements with Auto and Star sizing).
  • Interactive Mouse Dispatching: Components register visual interaction bounds into a spatial HitMap. Mouse clicks, movements, and scroll events are translated into clean component-level callbacks via ElementsMouseDispatcher.
  • Decoupled Execution Lifecycles: Use ThrottledAppLoopStrategy to throttle active rendering (e.g. 60 FPS) and background rendering (e.g. 10 FPS) when OS terminal window focus is lost. Wake up the render loop immediately on state changes using SignalWakeup().

Getting Started

Building an interactive TUI application:

using System.Text;
using Metriks;
using NeoKolors.Common;
using NeoKolors.Console;
using NeoKolors.Tui.Core;
using NeoKolors.Tui.Elements;
using NeoKolors.Tui.Lifecycle.Apps;

Console.OutputEncoding = Encoding.UTF8;

// 1. Setup screen, hit map, and lifecycle host
var screen = new NKCharScreen(NKConsole.WindowSize);
var hitMap = new HitMap();
var mouseDispatcher = new ElementsMouseDispatcher();
var host = new AppLifecycleHost();
var loopStrategy = new ThrottledAppLoopStrategy { ActiveFps = 60 };

int counter = 0;

// 2. Define the UI builder
IElement BuildUi() {
    var container = new Flex {
        Direction = FlexDirection.Column,
        Justify = FlexJustify.Center,
        Align = FlexAlign.Center,
        Width = screen.Size.X,
        Height = screen.Size.Y
    };

    var btn = new Button {
        Text = $"  Clicked {counter} Times  ",
        NormalStyle = new NKStyle(NKColor.FromRgb(255, 255, 255), NKColor.FromRgb(50, 70, 180), TextStyles.Bold),
        HoverStyle = new NKStyle(NKColor.FromRgb(255, 255, 255), NKColor.FromRgb(70, 110, 230), TextStyles.Bold)
    };

    btn.OnClick += () => {
        counter++;
        view.RootElement = BuildUi();
        view.Invalidate();
        loopStrategy.SignalWakeup();
    };

    var box = new Border(btn) {
        Title = " Counter Dashboard ",
        Style = NKBorderStyle.GetRounded(NKColor.FromRgb(0, 220, 180))
    };

    container.Add(box);
    return container;
}

// 3. Create view presenter
var view = new NKAppView(BuildUi(), screen, hitMap);

// Wire inputs
NKConsole.Mouse += m => {
    mouseDispatcher.Dispatch(hitMap, m);
    view.Invalidate();
    loopStrategy.SignalWakeup();
};

NKConsole.Key += k => {
    if (k.Down && (k.Key == KeyCode.ESCAPE || k.Char == 'q'))
        host.RequestClose();
};

// 4. Run the application
try {
    NKConsole.HideCursor();
    NKConsole.EnableAltBuffer();
    host.Start();

    while (host.State != LifecycleState.STOPPED) {
        loopStrategy.Tick(host, view);
    }
} finally {
    NKConsole.DisableAltBuffer();
    NKConsole.ShowCursor();
}

Documentation

For full guides, architecture diagrams, and tutorials, visit the official documentation: 👉 https://krykomdev.github.io/NeoKolors/

Product 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 is compatible.  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.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2026.4.0-preview.4 55 11/15/2026
2026.4.0-preview.3 66 11/1/2026
2026.4.0-preview.2 61 10/30/2026
2026.4.0-preview.1 71 10/23/2026
2026.2.0-rc2.1 87 6/8/2026
2026.2.0-rc2 93 6/5/2026
2026.2.0-rc1 87 6/2/2026
2026.1.0-alpha7 100 3/5/2026
2026.1.0-alpha6 92 2/28/2026
2026.1.0-alpha5 90 2/28/2026
2026.1.0-alpha4 93 2/27/2026
2026.1.0-alpha3 87 2/27/2026
2026.1.0-alpha2 93 2/26/2026
2026.1.0-alpha1 91 2/25/2026
0.25.21-alpha 223 5/19/2025
0.25.19-alpha 175 5/6/2025