QRCoder icon indicating copy to clipboard operation
QRCoder copied to clipboard

ASCII 'small' renderer prints inverted by default

Open Shane32 opened this issue 2 months ago • 1 comments

By default, the ASCII 'small' renderer prints inverted compared to the ASCII standard renderer or any other renderer. It has a boolean 'invert' argument, which defaults to 'false'; setting this to 'true' corrects the output. This is is likely caused by incorrect constants used in the code:

bool BLACK = true, WHITE = false;

var palette = new
{
    WHITE_ALL = "\u2588",
    WHITE_BLACK = "\u2580",
    BLACK_WHITE = "\u2584",
    BLACK_ALL = " ",
};

As seen above, the 'black' text constant consists of a space, while the the 'white' text constants are 'filled in'.

This should be fixed in v2, as it would be a breaking change for v1.

Shane32 avatar Oct 06 '25 06:10 Shane32

ChatGPT:

show me these characters

Here’s how those Unicode block characters look:

WHITE_ALL   = █   (U+2588 FULL BLOCK)
WHITE_BLACK = ▀   (U+2580 UPPER HALF BLOCK)
BLACK_WHITE = ▄   (U+2584 LOWER HALF BLOCK)
BLACK_ALL   = ␣   (space)

So visually:

Name Character Description
WHITE_ALL Solid block (full)
WHITE_BLACK Top half block
BLACK_WHITE Bottom half block
BLACK_ALL (space) Empty / background

These are part of the Unicode “Block Elements” range (U+2580–U+259F), often used for terminal graphics or low-resolution pixel art.

are they then incorrectly labeled?

Yes — they’re mislabeled as written.

Let’s break down what those characters actually represent versus what the names imply:

Label Character Actual Unicode Name Visual Meaning Why It’s Misleading
WHITE_ALL = "\u2588" FULL BLOCK Entire cell filled This should actually be BLACK_ALL, not “white,” since it’s a solid (inked) block.
WHITE_BLACK = "\u2580" UPPER HALF BLOCK Top half filled, bottom empty This represents black over white, so the label WHITE_BLACK is reversed.
BLACK_WHITE = "\u2584" LOWER HALF BLOCK Bottom half filled, top empty This represents white over black, so again reversed.
BLACK_ALL = " " (space) Blank cell This should be WHITE_ALL, not “black.”

So the correct mapping should be:

BLACK_ALL   = "\u2588", // █ full block
BLACK_WHITE = "\u2580", // ▀ top half (black on top)
WHITE_BLACK = "\u2584", // ▄ bottom half (black on bottom)
WHITE_ALL   = " ",      // space

In short: your color names are inverted — the filled portions are “black,” and the empty parts are “white.”

Shane32 avatar Oct 06 '25 07:10 Shane32