Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pick default theme based on terminal background color #67

Closed
walles opened this issue Aug 17, 2021 · 3 comments
Closed

Pick default theme based on terminal background color #67

walles opened this issue Aug 17, 2021 · 3 comments

Comments

@walles
Copy link
Owner

walles commented Aug 17, 2021

According to https://stackoverflow.com/a/7767891/473672 some terminals support querying the actual background color of the terminal window.

Unclear what happens with background images / transparency, but still.

Example usage, text after the second $ is the response from the terminal.

~ $ printf "\e]11;?\a"
~ $ ]11;rgb:fefe/f4f4/9c9c
@walles
Copy link
Owner Author

walles commented Oct 15, 2021

Example shell script for querying the terminal background color:

#!/bin/sh

OLDSTTY=$(stty -g)

stty raw -echo min 0
echo "\033]11;?\033\\"

# If this delay is too short you will miss your terminal's response
sleep 1

read -r ANSWER
stty "$OLDSTTY"

# Extract response body
RGB=$(echo "$ANSWER" | sed 's/[^r]*//' | sed 's@[^rgb:0-9a-f/]@@g')
echo "$RGB"

Example response: rgb:fefe/f4f4/9c9c

Inspired by: https://stackoverflow.com/a/30540928/473672

walles added a commit that referenced this issue Dec 28, 2023
This reverts commit ed49174, reversing
changes made to 12f316f.

Before this goes in, we should first auto detect bright vs dark terminal
background and default to different themes in those two cases: #67
@walles
Copy link
Owner Author

walles commented Dec 28, 2023

We should re-apply ed49174 (pick status bar color based on the current style) or something to that effect after this is done.

@walles
Copy link
Owner Author

walles commented Jan 19, 2024

@walles walles closed this as completed Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant