Skip to content

How to set the Color for a single Char ? #150

Answered by magiblot
paule32 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Jens! Sorry for not replying earlier.

If you look at the writeChar function:

void TView::writeChar( short x, short y, char c, uchar color, short count ) noexcept
{
if (count > 0)
{
TScreenCell cell;
::setCell(cell, c, mapColor(color));

You will see that the color parameter is a uchar (instead of a TColorAttr) and that it is passed as an argument to mapColor. This means the color parameter of writeChar is meant to be a color palette index instead of a literal color, which is why you don't get the result you expected.

The "white on red" color you see is the color shown for invalid pa…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by paule32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants