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

Add Terminal.get_fgcolor() and Terminal.get_bgcolor() #237

Merged
merged 6 commits into from Jan 6, 2023
Merged

Add Terminal.get_fgcolor() and Terminal.get_bgcolor() #237

merged 6 commits into from Jan 6, 2023

Conversation

stefanholek
Copy link

No description provided.

@avylove
Copy link
Collaborator

avylove commented Apr 22, 2022

Sorry we haven't responded to this sooner.

I think there's too much duplication of code. We should probably pull the try/finally block into its own method, maybe a context manager, since that code is the same in three places except a few variables. Then maybe we can do something like:

with self.query_response(query_str, response_re, timeout) as match:
    if match:
        return tuple(int(val, 16) for val in match.groups())

return -1, -1 , -1

@codecov
Copy link

codecov bot commented Jan 5, 2023

Codecov Report

Base: 95.15% // Head: 95.18% // Increases project coverage by +0.03% 🎉

Coverage data is based on head (f25692a) compared to base (7a114c3).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #237      +/-   ##
==========================================
+ Coverage   95.15%   95.18%   +0.03%     
==========================================
  Files           9        9              
  Lines        1011     1018       +7     
  Branches      215      215              
==========================================
+ Hits          962      969       +7     
  Misses         45       45              
  Partials        4        4              
Impacted Files Coverage Δ
blessed/terminal.py 97.84% <100.00%> (+0.03%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@avylove
Copy link
Collaborator

avylove commented Jan 5, 2023

I rebased and consolidated the common code. Then I noticed all the test data was ffff/ffff/ffff, so I used somes X11 colors instead to make them in range and different values. Out of range values still work, but I don't think it's our place to police that. If the terminal wants to report the values higher than 255, I don't think we care.

@jquast, I think this looks ok to merge. Can you take a look?

@avylove avylove merged commit f77e676 into jquast:master Jan 6, 2023
@avylove avylove linked an issue Jan 6, 2023 that may be closed by this pull request
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

Successfully merging this pull request may close these issues.

Interest in get_fgcolor() and get_bgcolor()?
3 participants