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

How is the color encoded in screen? #150

Open
kovkev opened this issue Sep 8, 2021 · 2 comments
Open

How is the color encoded in screen? #150

kovkev opened this issue Sep 8, 2021 · 2 comments

Comments

@kovkev
Copy link

kovkev commented Sep 8, 2021

When I print(str.encode(screen.display[0])), it seems like color is not encoded.

@kovkev
Copy link
Author

kovkev commented Sep 8, 2021

Color is encoded in Char_s inside of Screen and are not returned by Screen.display

@eldipa
Copy link
Contributor

eldipa commented Jul 16, 2022

Nope, Screen.display returns a plain styleless text. To get the details of each characters, including their colors you have to query each character:

for y in range(screen.lines):
   line = screen.buffer[y]
   for x in range(screen.columns):
        char = line[x]
        print(char.fg, char.bg) # foreground/background colors

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

2 participants