uiua-lang / uiua

A stack-based array programming language
https://www.uiua.org
MIT License
1.53k stars 107 forks source link

support light terminal theme #466

Closed TeddyDD closed 5 months ago

TeddyDD commented 5 months ago

Related to #224 because the core issue was not solved.

REPL and console output is unreadable on bright terminal themes, due to hardcoded pastel colors.

Let's take a look at my terminal: image image

Code printed by the REPL is not legible.

I see two solutions to this problem:

  1. Use 16 standard ANSI colors according to their names and assume the user configure terminal to make colors legible in both dark and light mode. image
  2. Use 24 bit color. Allow the users to configure color theme by specifying token type - color mappings (example: Constant = #ff0000). This can be achieved via configuration file, xresources, env variable (like LS_COLORS) etc. This method should also assume the user can change theme at any time. Perhaps \e]11;?\a escape code could be used to determine what theme to use?

224 --no-color flag is only partial solution because I want colors while using light theme :smile:


This problem does not affect the pad, code is legible in both light and dark theme.

image image

kaikalii commented 5 months ago

I have switched to ANSI colors for everything except number literals, which in my testing seem legible with the orange color in light or dark mode.

kaikalii commented 5 months ago

Sorry, I forgot about the colored output

kaikalii commented 5 months ago

Weird, the output colors look fine for me in both light and dark mode. image image

TeddyDD commented 5 months ago

I compiled main right now and it fixes the code colors 👍️ image

Literals are not readable. Tested on wezterm, alacritty and contour. image

This is how ansi --color-codes output looks like for me: image

kaikalii commented 5 months ago

This may be fixed in 9796237ac13212f7b4ab. While I see no difference in my environment, please let me know the results on yours.

TeddyDD commented 5 months ago

obraz obraz

Colors are quite subtle, but it fixes the issue. Thanks!