Adds support for a new color theme mode #119
No reviewers
Labels
No Label
blocked
bug
build
documentation
duplicate
enhancement
finger
gemini
gopher
help wanted
http
in progress
invalid
local
needs-info
non-code
non-functional
non-urgent
question
release
rendering
suggestion
telnet
terminal
urgent
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sloum/bombadillo#119
Loading…
Reference in New Issue
No description provided.
Delete Branch "add-color"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR adds a new theme
color
. The function of this theme is to enable escape sequences when rendering content. At first glance this mode will look just likenormal
mode, unless a user is viewing content containing escape sequences. While coding the features that would enable color, I found that they were incompatible with theinverse
theme, since the color codes on a page may overwrite the theme color codes. As such it seemed best to make it its own theme. An update to the manpage was made to reflect this new feature and validation was added where needed to allow for this to be selected.The best way to test the new theme is to do the following:
make && ./bombadillo gemini://konpeito.media
normal
orinverse
mode (whichever you were using)set theme color
I think I would like to update this so it validates the color code first. If I am udnerstanding the color codes correctly all of them should take this form:
In other words they always end in
m
. Right now I am letting them end in any letter, which can allow for much more screen manipulation that I would like to allow. Switching up to buffering the escape codes and adding them only if they are valid would be a good approach. I'll update this PR tonight or later this weekend.Very cool. The effect looks good and seems to work well with the bookmarks bar and other visual elements.
For me, setting the mode to color seems to just use the normal theme. To reproduce, on any page, enable inverse, then enable color.
Regarding the code definition, codes may start with other numbers than 33 from what I can see.
Have you been able to see if this has an effect on rendering speed?
Also, I am not sure about this setting being part of the theme, especially if it is meant to inherit the previous theme's settings. It makes sense in a gameboy sort of way though.
Glad you like the effect! It took a bit to get the right balance with the bookmarks bar.
I'm not sure what you are saying with your second line. It should look like the normal theme unless there is color. Inverse should not support color at all and I definitely do not experience any weirdness moving between the three themes.
33
is the octal rendering ofESC
(which should be how all of them start). Sometimes you'll see 27 oru001b
other things, but they all amount toESC
and all represent the same character.I have not noticed any added rendering time. It still seems pretty snappy. We were already parsing these values so it should be an
O(1)
addition.It is absolutely not supposed to inherit the previous theme's settings. The way I think about it is:
normal
= Black and whitecolor
= Color... but in an early tv way, where most stations still didnt send color datainverse
= White and blackI just updated to only allow the
m
series of escape codes (which should allow for any color modifications as well as bold and the like, but disallow cursor movement or things like that).I also noticed when looking at a local file that I wanted to see escape codes rendered literally, since the local scheme should function like a pager. So I added a slight adjustment to make sure that no matter the theme local mode does not filter out or render the escape codes. Rather it replaces the esc character with
"\033"
so they look like what they are in a document. This lets someone download a gemini or gophermap and then see what is in it all from within bombadillo, which I like. Hopefully I explained that clearly. I definitely think that part is the way to go no matter what happens with color.OK that is all good. I misinterpreted the original instructions to mean that the colour theme inherited the previous theme.
Thanks for the explanation regarding �33, I'm still learning this topic.
This new version seems to work just as well. I like:
Your explanation of the TV thing is what I was thinking too. Maybe the word theme is what trips me up a bit. When I first saw this PR I was like "oh the title bar must have a new background colour".
Have you thought about if this setting will be enabled by default?
A user sent me some more links that are out there in the wild using color:
The first two are tomasino. The second one is a whole collection of colors to test display output. Works really well one my system.
No problem :) All the different ways to represent characters gets really confusing. I still dont know when to use bytes vs runes in go (I tend toward using runes since they seem to represent characters, which could be multiple bytes).
Cool! I had not seen the naruto one.
Yeah, the word theme had me a little unsure if I wanted to put this feature there or not... but since it isnt compatible with inverse it felt like it was another 'skin' in addition to the existing ones. I think my feeling is that normal mode should remain the default. Hopefully users read the docs and see that they have all these options. I really feel like we have built out a cool suite of ways for people to use the program. I havent had too many reports from "out in the wild", but I think people are discovering things with it. I hope so anyway. I know the person running tilde.pink, whose name I cannot remember how to spell...tiwesdaeg(?) has been using it and has tried out color mode and gave me good feedback.
"Visual mode" as described in the man page is a good way to describe it. Something to include in the next release notes.
This looks pretty good.