CC: Tweaked

CC: Tweaked

42M Downloads

clear should reset the palette colours

Luca0208 opened this issue ยท 6 comments

commented

After a program modified the palette colours it can be quite difficult to interact with the console, having to go into the Lua interpreter and resetting the colour palette can be difficult.

I suggest that clear should reset the palette colours in addition to clearing the screen.
If adding that behaviour to the existing clear program is too big of a modification I'd suggest adding a "reset" program that clears the screen and resets the palette. (That would be similar naming to the respective Linux/Unix programs).

This would be especially useful for monitors where the only option to reset the palette colour without doing it via Lua is to break and replace the monitor.

I'd welcome feedback on this idea. If this suggestion is accepted I can create a PR to implement either option.

commented

Probably better to have a separate reset program. Several of my computers start with a custom palette, and its definitely surprising for clear to reset that.

commented

Alternatively, clear could be modified to add an option such as clear reset, instead of making a new program. reset is a very vague name, and some people might confuse it with reboot.

commented

I like the argument route as follows:
clear -> clears the screen, preserves the old behavior
clear screen -> same as clear
clear palette -> resets the palette to defaults
clear all -> clears the screen and resets the palette

commented

I think resetPalette would be even clearer. Or even resetColourPalette but then you would need to add the wrong spelling version. Separate program or as an argument on clear both make sense with this clearer name.

commented

Adding an argument to clear would also mean less code duplication. I can create a PR if you want.

Maybe we could extract the clear/resetPalette code into a seperate module to implement something similar to #163 Although as neither clearing the screen, nor resetting the palette requires a lot of code that would create a rather small module.

commented

I don't really think it's worth it - clearing is 2 LOC, and resetting the palette is 3. PR would be much appreciated though :).