You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In lots of terminals, it's possible to detect the background colour of the terminal with something like this:
#!/bin/bash
oldstty=$(stty -g)
stty raw -echo min 0 time 0
printf "\033]11;?\033\\"
result=""
while [ -z "$result" ]; do
read -r result
done
stty "$oldstty"
echo "$result" | sed -E 's/.*(rgb:[a-f0-9/]{14}).*/\1/'
Then you get output like rgb:0000/0000/0000, rgb:ffff/ffff/ffff, rgb:158e/193a/1e75, etc.
Textual could use this to select a dark or light theme by default. This would be nice as apps would behave and look as users expect them without any configuration.
I would prefer this to happen automatically but, if you think this is not good as some terminals don't support this, then textual/rich could at least provide code to detect this.
I'd be happy to investigate this further but I don't fully understand how this ANSI-escape-based magic works. Is there some other code in rich/textual where you write something from a TTY and read back the reply?
In lots of terminals, it's possible to detect the background colour of the terminal with something like this:
Then you get output like
rgb:0000/0000/0000
,rgb:ffff/ffff/ffff
,rgb:158e/193a/1e75
, etc.Textual could use this to select a dark or light theme by default. This would be nice as apps would behave and look as users expect them without any configuration.
I would prefer this to happen automatically but, if you think this is not good as some terminals don't support this, then textual/rich could at least provide code to detect this.
I mention it in https://discord.com/channels/1026214085173461072/1033752510848053399/1075543323516866662 a while ago, but then forgot to open an issue.
The text was updated successfully, but these errors were encountered: