-
Notifications
You must be signed in to change notification settings - Fork 138
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
256-color access from __getattr__() #67
Comments
Alright... I've been thinking about this for over a year now(!) You do warrant some reply by now :) I disagree with you! :) Some background: https://gist.github.com/XVilka/8346728 In brief: if As an API, supporting rgb method
This would be exactly like the existing true_colorspace context manager
This is necessary as a context manager: we cannot determine whether the given terminal emulator supports true colors: There is no Compound Formatters as X11 color namesUse the official X11 color names, http://en.wikipedia.org/wiki/X11_color_names as compound formatters. These are mapped by their hexidecimal values to rgb() to emit the appropriate sequence. This allows one to use "deep_pink", which is (255, 20, 147), but on a 16-color terminal it would be mapped to the same sequence as term.bright_red. |
Wow, you've been thinking on this at levels way beyond my original suggestion, haha. I see your reasoning to as why my suggestion would not be something desired, and I can leave it at that. It's just a nicety anyways. I feel I can't really contribute to the inner workings you are talking about, but I am convinced that you are going to do the right thing. Keep up the good stuff! 👍 |
+1 on rgb(). I also agree with the spirit of true_colorspace() (or maybe "true_color()" for brevity), but I feel like it might make more sense as a Terminal constructor kwarg. Is there a reason to want to push and pop its activation like location()? |
After sleeping on it, I realize that a mere constructor arg will not suffice: it would have to be a constructor arg that lands in a public instance var. Otherwise, it would be very cumbersome to make an interactive program which could toggle true-color mode in response to user input (which might be a common case, since we have nothing to guess based on). |
256 and 24-bit color support is released in blessed, which is API-compatible with blessings, https://blessed.readthedocs.io/en/latest/colors.html |
I love the API where you can just to
term.bold_white
etc. The only thing I am missing is to be able to specify colors in the extended 256-color range in the same manner. I mostly use the blessings coloring with Logbook loggers and I use them in string formatters, passing theTerminal()
object ast
.Right now I have to call the
color()
function to get the code out, and doing so means I need to pass the colors I want to the.format()
call. It would be really awesome to be able to use{t.bold_color196}
directly instead.Would this be possible? :)
The text was updated successfully, but these errors were encountered: