cprintf - display formatted colored text in Command Window
Displays sprintf-formatted strings in the Command Window using the specified color/underline/bold style
https://undocumentedmatlab.com/articles/cprintf-display-formatted-color-text-in-command-window
You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
Cite As
Yair Altman (2026). cprintf - display formatted colored text in Command Window (https://au.mathworks.com/matlabcentral/fileexchange/24093-cprintf-display-formatted-colored-text-in-command-window), MATLAB Central File Exchange. Retrieved .
Acknowledgements
Inspired: TextTable, r0oland/motivate-me, setPrompt - Set the Command Window prompt, TXTMENU - Text-Based Menu for the Command Window, tcprintf : ANSI colored output in terminal, ecopath_matlab: A Matlab implementation of Ecopath, Colored Calendar, Spike Extraction Tool, Lynx MATLAB Toolbox
General Information
- Version 2.0.0 (55.1 KB)
MATLAB Release Compatibility
- Compatible with R2006a and later releases
Platform Compatibility
- Windows
- macOS
- Linux
| Version | Published | Release Notes | Action |
|---|---|---|---|
| 2.0.0 | Added extra named colors; reverted unnecessary R2026a fix; clarified description |
||
| 1.22.0 | test |
||
| 1.21.0 | Added extra named colors; reverted unnecessary R2026a fix; clarified description |
||
| 1.20.0 | Added predefined color names & Dark/Light variants, updated demo, fix for reported R2026a newline problem |
||
| 1.19.0 | Workaround for hyperlink style on Javascript & online desktops reported by Meike |
||
| 1.18.1 | Updated description text (added usage examples output screenshot). No code was changed. |
||
| 1.18.0 | Fixed "stuck" color styling in case of invalid escape sequence reported by Alex N |
||
| 1.17.0 | Fixed auto-hyperlink in R2025a+; empty style now means 'text' |
||
| 1.16.0 | Output to STDERR if style is 'error', 'red' or [1,0,0] (non-Desktop modes only) |
||
| 1.15.0 | Support R2025a (new Matlab desktop) |
||
| 1.14.0 | Fixed cases of using string (not char) inputs |
||
| 1.13.0 | Fixed cases of invalid colors (especially bad on R2021b onward) |
||
| 1.12.0 | Updated the compatibility boxes to reflect that CPRINTF does NOT work starting with R2021b (only up to R2021a). No code was changed. |
||
| 1.12.0-0 | Enabled specifying color in multiple ways: as #RGB or #RRGGBB (hexadecimal codes e.g. '#a0b0FF'), or [0.1,0.7,0.3], or [26,178,76] |
||
| 1.11.0 | Fix by T. Hosman for embedded hyperlinks; package as a toolbox |
||
| 1.10.0 | Fixed a few discoloration issues (some other issues still remain) |
||
| 1.9.0 | Fix: if command window isn't defined yet (startup) use standard fprintf, as suggested by John Marozas |
||
| 1.8.0 | Fix: if command window isn't defined yet (startup) use standard fprintf, as suggested by John Marozas |
||
| 1.7.0 | Graceful degradation support for deployed (compiled) and non-desktop applications; minor bug fixes |
||
| 1.6.0 | Fixes for R2012b; added bold style; accept RGB string (non-numeric) style |
||
| 1.5.0 | Fixes for R2011b; fix by Danilo (FEX comment) for non-default text colors |
||
| 1.4.0 | Performance improvement |
||
| 1.3.0 | Minor fix for R2010a/b; fixed edge case reported by Sharron; CPRINTF with no args runs the demo |
||
| 1.2.0 | Fixed some problems reported by Andreas G, Swagat K |
||
| 1.1.0 | Fixed some problems reported by Andreas G & Swagat K |
||
| 1.0.1 | test |
||
| 1.0.0 |