CC: Tweaked

CC: Tweaked

59M Downloads

Invalid color check fails.

viwty opened this issue ยท 1 comments

commented

Minecraft Version

1.20.x

Version

1.109.6

Details

This was found by a different person in the discord guild.
When trying to set the background/text color to something invalid, like 100, advanced computers error as they should.
image
However, this is not the case with basic computers and monitors.
image
image
(The monitor color does change)
I assume this is the case because multishell checks if the color is valid, but the native terminal errors silently.

commented

So there's a mismatch here between what the various term implementations do:

The term.Redirect contract is a little underspecified here in terms of what values are supported. I think we probably need to make the following changes:

  • window should use color.toBlit (or probably an inlined version, to minimise the performance cost).
  • color.toBlit should perform bounds checks - color.toBlit(2 ^ 16) will currently return "10", when it should error.
  • Update the term.Redirect documentation to specify the expected behaviour:
    • Callers of set.*Colou?r functions should only pass in valid colours.
    • Implementations may accept invalid colours, following the conversion logic in colors.toBlit.