Closed tavinus closed 8 years ago
Sorry for the double-post.
I was checking if my terminal is running in 16 or 256 colors.
To my surprise, even though OSX's terminal is set to xterm
(not xterm-256color
) I get 256 colors when testing via perl.
I am using this script to test, and you can see what it would be on 16 colors there. I am still not sure why the results can be so different for the gray theme.
I have no experience with colors on bash, so I am still learning. Any insights are welcome. Any good links are welcome too. I will re-read your explanations on colors at OutsideIT as well.
Cheers! Gus
Dont worry too much about it. It could be related to the color scheme im using in ConEmu at my end. But very busy here. Ill try to test.
Hummm... My $TERM variable was indeed set to xterm
and it seems that it has 8 colors only.
When testing:
$ echo "$TERM"
xterm
$ tput colors
8
Then:
$ export TERM="xterm-256color"
$ tput colors
256
So it seems that my terminal is 256 capable on both ends, but I am set to 8 colors (because of the xterm
variable). That is ignored by the perl script though.
I was wondering if it would be nice to have color detection inside FireMotD. It could be just a parameter for the user to test it (that displays 8 / 16 / 256 as an answer). Or if we should test for it before running.
I will get there eventually. Cheers! Gus
It would be very nice to be able to detect the number of supported colors! I looked into that a few years ago but its hard to test. Feel free to add a parameter. In a later stadium we could downsample 256 themes if we detect the terminal doesnt support it.
First thing I wonder is if tput
is available everywhere. But since tput
's info seems to depend on the variable $TERM
, maybe we can just test the variable itself. EDIT: tput
is even available in MacOS.
But that detects the setting, not the capabilities. In my case for exemple, I am set to xterm
(8/16 colors) even though my terminal is capable of 256colors.
I work with some systems that have old stuff that NEEDS non UTF chars and 16 color mode. My terminal options are global though, which is why I end up using those same setting on other servers. Encoding is very problematic, I end up changing it a lot, which is annoying. I should probably install iTerm and use it on non-UTF, leaving the system's terminal with UTF-8 and xterm-256color.
I will see if there is another way to detect color capabilities (without using the $TERM variable).
I like that 256 color test with the cubes. Is it ok for you if I port that to FireMotD? I mean, make our colortest do that?
I kind of miss having a color map as well (with the numbers). Helps with building the themes. If I change the colortest to just show the cubes, I could make a parameter to also show the colomap (with the numbers). Say calling FireMotD -C colormap
would trigger mapping. So the map would be something like this:
And the normal colortest FireMotD -C
would be something like the example above (without the numbers).
Or we can just have separate options for each.
Say something like FireMotD -M
for colormap.
Also, regarding the Gray theme, I may have used some colors that are just Mac's Terminal. I will change it for real 16 colors soon (I think I have some big numbers there).
I have a commit of a new gray theme on the dev-tavinus branch of my fork. It is using 256color mode for many shades of gray. 16color has only 3 or 4 I think, so no real gray 16color theme is possible.
I was wondering if I could use the GenerateBasic16Color
function to generate a 256 color theme and it actualy did. Not too sure if there are any problems with this approach though.
Maybe we can change some things so that all themes use the GenerateBasic16Color
function? On wich case the function could be renamed to something more generic.
EDIT: I have also implemented the colortest with colorcube + colormap thing on dev-tavinus. I think I will still edit the gray theme before a pull request though. You can test from there if you like. Cheers!
Preview:
Gonna close this as I have already rebuilt the gray theme... Cheers!
Mannn... The gray theme looks so different here: Can't read half the stuff on your screenshot of the gray. I need to test it on a 256 color environment I guess? Not too sure how I can reproduce that...
EDIT: I am wondering how I can F-Up a gray theme... LOL
Gus