Text that knows where it is.
Shiocus is a lightweight C++ terminal text-positioning library with word tracking, per-word focus colors, and index-based rendering.
![]() |
![]() |
![]() |
![]() |
![]() |
- Overview
- Features
- The Two Colors
- Architecture
- Quick Start
- Use Cases
- Why Shiocus
- Comparison
- Design Philosophy
- License
Shiocus is a lightweight C++ library for placing text on a terminal with precision. It doesn't animate, it doesn't decorate β it tracks. Every word you give it becomes a numbered entry. Every entry remembers where it lives and what color it should be. Then, on demand, you render β and Shiocus paints each word exactly where it belongs.
The name is a collision of two ideas: "shi" (shift) and "ocus" (focus). Focus highlights. Shiocus keeps your words where you left them β and lets you call any one of them into the light.
Terminals are grids. Text is streams. The two don't naturally agree β once you print, the cursor moves, and the word you meant to highlight is already gone. Shiocus bridges that gap.
- Zero Dependencies β No libraries. No frameworks. No linker headaches. Just C++ and the terminal you're already sitting in.
- Self-Contained β One class. One behavior. One thing done well.
- True Color β Full 24-bit RGB, so your focus state can be any shade you want it to be.
- Words as objects β Each word has an identity: row, column, index, text, focus flag, color.
- Meant to be tuned β Focus, color, index β all exposed. All waiting for you.
- 24-bit True Color β Full RGB spectrum, no compromise
- Hex Color Support β
#FF5733format - RGB Function Support β
rgb(255,87,51)format - Independent Default & Focus Colors β The focused word can be a completely different color from the rest
- Automatic Word Wrapping β Text wraps inside the terminal bounds
- Newline Handling β
\nadvances the cursor to the next line - Smart Chunking β Long words that exceed a line are split across lines
- Per-Word Indexing β Every word gets a unique index as it's placed
- Focus by Word or by Index β Two ways to call a word into the light
- Simple Setup β Initialize an origin, set text, render
- Safe by Default β Bounds-checked placement, no out-of-terminal writes
- No Config Files β Everything is set in code
- Single Render Call β
render()draws everything at once
Shiocus has two states. Every word is in one of them.
Every word starts here. White by default, but configurable to anything you want. This is the resting state β text that's present but not called out.
engine.setDefaultWordColor("#FFFFFF");When you focus a word, it changes color and every other word drops back to default. Only one word is focused at a time. This is the state that says: look here.
engine.setWordOnFocusAndColor("Hello", "#FF0064");Both states support hex and rgb(...) formats. Both are full 24-bit RGB. Focus by word matches on text β focus by index matches on position in the placement order.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Application Layer β
β ββββββββββββββββ ββββββββββββββββββ βββββββββββββββββ β
β β text() β β setDefaultColorβ β setFocusColor β β
β ββββββββββββββββ ββββββββββββββββββ βββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Placement Layer β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Word Splitting β’ Wrapping β’ Cursor Advance β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Word Store β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Row β’ Col β’ Index β’ Text β’ Focus β’ RGB β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Terminal Layer β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Cursor Positioning β’ Foreground Color β β
β β Bounds Checking β’ Flush β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
Terminal Display
Shiocus builds an in-memory word list first, then draws it on render(). There's no frame buffer, no diffing pass β just positions and colors, applied on demand.
- C++11 or higher compiler
- POSIX terminal β Linux, macOS, BSD, WSL
- 24-bit true color support β Most modern terminals handle this
# Clone the repository
git clone https://github.com/intriXlabs/Shiocus.git
# Compile with optimizations
g++ -O3 -std=c++11 shiocus_demo.cpp -o shiocus
# Run the demo
./shiocus#include "shiocus.cpp"
int main() {
Shiocus engine;
// Define the origin: row, col
engine.initialize(2, 4);
// Set the resting color (hex)
engine.setDefaultWordColor("#FFFFFF");
// Place some text
engine.text("Text that knows where it is.");
// Call one word into the light
engine.setWordOnFocusAndColor("knows", "rgb(255, 0, 100)");
// Draw
engine.render();
return 0;
}Log lines, search results, status messages β anything where one word needs to stand out from the rest.
engine.text("Build succeeded in 4.2s");
engine.setWordOnFocusAndColor("succeeded", "#00FFAA");
engine.render();Menu options, prompts, and selections where the active item needs to be visually distinct.
Fixed-position readouts β labels and values placed once, updated by re-rendering with new focus.
Print a block of text, then walk through it by index to see exactly where each word landed.
Anywhere a plain printf leaves you guessing where the cursor went. Placement, made explicit.
Most terminal projects fall into one of two camps: they print text and forget it, or they build a whole TUI framework. Shiocus sits in between.
It doesn't want to render a full interface. It doesn't want to manage input. It doesn't want to own your terminal. It just wants to remember where your words are β and then let you point at one.
If you're placing text and you want to find it again β this is what it's for.
| Shiocus | Plain printf |
Full TUI Libraries | |
|---|---|---|---|
| Dependencies | None | None | Several |
| Setup | One class | Trivial | Framework to learn |
| Positioning | Tracked, per-word | Manual \033[H |
Framework-managed |
| Color Control | Full RGB + focus | ANSI only | Varies |
| Scope | Word placement & focus | Print only | Full-screen UI |
| Feel | Precise, deliberate | Static | Functional, boxy |
| Learning curve | Minutes | Seconds | Hours to days |
Shiocus isn't trying to replace your TUI library. It's trying to make the words inside it findable.
Shiocus is small on purpose.
- It doesn't try to be a rendering engine.
- It doesn't try to be a framework.
- It doesn't ask you to adopt a build system, a config file, or a new way of thinking.
It's one class that does one thing well.
Colors, focus, indices β these aren't buried constants. They're exposed, documented, and waiting for you to tune them. You're supposed to reshape it.
when a word gets split across lines because it's too long for the remaining space, each chunk becomes its own word entry with its own index. setWordOnFocusAndColor("word", ...) will match every chunk with that exact text β so focusing a split word lights up all its pieces, not just one.
if you need to focus a single chunk, use setIndexOnFocusAndColor(index, ...) instead.
Licensed under the MIT License. See LICENSE for details.




