Console is a powerful static class that brings modern terminal capabilities to your Delphi Win32 console applications. From vibrant ANSI text formatting to precise cursor control and interactive input handling, it gives your apps a professional polish — all with zero dependencies and written entirely in Pascal.
✨ Print. 🎞️ Animate. 🎮 Control.
All in pure 🐘 Delphi.
- 🎨 ANSI Styling – Set foreground/background colors, RGB or named, and bold text
- 🖋️ Formatted Output – Print and PrintLn support standard arguments and text wrapping
- ⌨️ Input Handling – Detect key presses/releases, read individual keys or typed input
- 📺 Cursor Management – Move, show/hide, save/restore, and query cursor position
- 🧼 Screen Control – Clear screen, lines, or portions of a line with color support
- 🎬 Teletype Simulation – Animate output character-by-character with dynamic delays
- 🎲 Utility Methods – Random values, terminal title management, safe delays, and more
- 🧪 Delphi IDE-aware – Automatically adapts when run inside the Delphi IDE
uses Console;
begin
TConsole.ClearScreen();
TConsole.SetTitle('Demo');
TConsole.PrintLn('Welcome to Console!');
TConsole.Teletype(CSIFGGreen+'Simulated output... one char at a time.');
TConsole.WaitForAnyKey();
end.
Print
,PrintLn
– With or without argumentsTeletype
– Simulate typewriter-style printingWrapTextEx
– Word-wrap long text intelligently
SetForegroundColor
,SetBackgroundColor
– Named ANSI colorsSetForegroundRGB
,SetBackgroundRGB
– Full RGB color supportSetBoldText
,ResetTextFormat
– Styling control
SetCursorPos
,GetCursorPos
– Move or retrieve cursor positionMoveCursorUp/Down/Forward/Back
– Relative movementSaveCursorPos
,RestoreCursorPos
ShowCursor
,HideCursor
,SetCursorVisible
ClearScreen
,ClearLine
,ClearToEndOfLine
ClearLineFromCursor
– In color!
ReadKey
,ReadLnX
– Get typed charactersWaitForAnyKey
,AnyKeyPressed
IsKeyPressed
,WasKeyPressed
,WasKeyReleased
ClearKeyStates
,ClearKeyboardBuffer
SetTitle
,GetTitle
GetSize
– Terminal width and heightPause
– Print a pause message and waitWait
– Delay in millisecondsRandomBool
,RandomRange
HasOutput
– Detect if console has valid output streamWasRunFrom
,IsStartedFromDelphiIDE
– Detect development environment
- Should work with any Delphi version with Unicode support.
- Windows 10+ Console with ANSI support (Virtual Terminal Sequences)
- Developed and tested using Delphi 12.3, Windows 11 (64 bits)
Console.pas
– Main unit (pure static class)- No dependencies, no DLLs, no third-party units — just drop it in and go.
Console demos
click image to open video
🚧️ This repository is currently under construction.
Console is actively being developed. Features, APIs, and internal structure are subject to change.
Contributions, feedback, and issue reports are welcome as the project evolves.
- 🐞 Report issues via the Issue Tracker.
- 💬 Engage in discussions on the Forum and Discord.
- 📚 Learn more at Learn Delphi.
Contributions to ✨ Console are highly encouraged! 🌟
- 🐛 Report Issues: Submit issues if you encounter bugs or need help.
- 💡 Suggest Features: Share your ideas to make Console even better.
- 🔧 Create Pull Requests: Help expand the capabilities and robustness of the library.
Your contributions make a difference! 🙌✨
Console is distributed under the 🆓 BSD-3-Clause License, allowing for redistribution and use in both source and binary forms, with or without modification, under specific conditions.
See the 📜 LICENSE file for more details.
🖥️ Console — Modern Console Power for Delphi. ✨ Print. 🎞️ Animate. 🎮 Control. All in pure 🐘 Pascal.