Adds support for a new color theme mode #119

Manually merged
sloum merged 4 commits from add-color into develop 2019-12-14 15:38:17 +00:00
Owner

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 like normal 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 the inverse 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:

  • Checkout and pull the branch
  • make && ./bombadillo gemini://konpeito.media
  • You should see a website in either normal or inverse mode (whichever you were using)
  • Run set theme color
  • If all went well you now see color. You should be able to open the bookmarks bar and scroll and all that.
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 like `normal` 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 the `inverse` 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: - Checkout and pull the branch - `make && ./bombadillo gemini://konpeito.media` - You should see a website in either `normal` or `inverse` mode (whichever you were using) - Run `set theme color` - If all went well you now see color. You should be able to open the bookmarks bar and scroll and all that.
sloum added the
enhancement
non-urgent
rendering
documentation
labels 2019-12-12 04:33:55 +00:00
sloum added this to the 2.1.0 milestone 2019-12-12 04:33:59 +00:00
asdf was assigned by sloum 2019-12-12 04:34:03 +00:00
Author
Owner

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:

33[(?:d+;?)+m

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.

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: ```shell �33[(?:d+;?)+m ``` 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.
Collaborator

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.

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.
Author
Owner

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 of ESC (which should be how all of them start). Sometimes you'll see 27 or u001b other things, but they all amount to ESC 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 white
  • color = Color... but in an early tv way, where most stations still didnt send color data
  • inverse = White and black
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 of `ESC` (which should be how all of them start). Sometimes you'll see 27 or `u001b` other things, but they all amount to `ESC` 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 white - `color` = Color... but in an early tv way, where most stations still didnt send color data - `inverse` = White and black
Author
Owner

I 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.

I 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.
Collaborator

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:

  • gopher://tilde.pink:70/1/~fc03cf/colors
  • gopher://tilde.black:70/1/users/genin

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?

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: - gopher://tilde.pink:70/1/~fc03cf/colors - gopher://tilde.black:70/1/users/genin 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?
Author
Owner

A user sent me some more links that are out there in the wild using color:

  • gopher://tilde.pink/1/~fc03cf/
  • gopher://tilde.pink/1/~fc03cf/colors
  • gopher://tilde.pink/1/~ff3366/

The first two are tomasino. The second one is a whole collection of colors to test display output. Works really well one my system.

A user sent me some more links that are out there in the wild using color: - gopher://tilde.pink/1/~fc03cf/ - gopher://tilde.pink/1/~fc03cf/colors - gopher://tilde.pink/1/~ff3366/ The first two are tomasino. The second one is a whole collection of colors to test display output. Works really well one my system.
Author
Owner

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.

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.
Collaborator

"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.

"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.
sloum closed this pull request 2019-12-14 15:38:17 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sloum/bombadillo#119
No description provided.