akinomyoga / blesh-contrib

Source of settings for Bash Line Editor https://github.com/akinomyoga/ble.sh (for ble-0.4+)
BSD 3-Clause "New" or "Revised" License
32 stars 8 forks source link

can you add predefined themes based on gogh #23

Open d4rkb4sh8 opened 2 weeks ago

d4rkb4sh8 commented 2 weeks ago

can you add predefined themes based on the color profiles on gogh: [https://github.com/Gogh-Co/Gogh] so users can easily switch to premade themes. Love the work BTW.

for example theme and corresponding number

and can be executed with a specific theme command like ble-theme-change=192

akinomyoga commented 2 weeks ago

Before thinking about it, can I confirm the background for this request? If you want to make ble.sh use the current terminal's color theme, you can simply specify bleopt color_scheme:

# ~/.blerc

bleopt color_scheme=base16

That should be enough in the most cases, and there is no need to add color themes in ble.sh.

Or do you actually want to configure ble.sh to use a color theme different from the one in your current terminal? In such a case, if your terminal supports 24-bit color codes, you can use bleopt colorglass_base16_palette defined in module colorglass:

# ~/.blerc

bleopt color_scheme=base16
ble-import colorglass
bleopt colorglass_base16_palette=NAME_OF_COLOR_THEME

where NAME_OF_COLOR_THEME in the above example should be replaced by one of the base16 palette names listed here.

Or do you request something more than just applying the terminal's themes? For example, do you want a full-scratch color scheme that would work well with each terminal's theme (instead of just applying it)? That would be a very hard work. Designing even a single color scheme would take much time for consideration, and there seem to be hundreds of themes in Gogh. I don't have time, but pull requests for good-quality new color schemes are welcome.


can you add predefined themes based on the color profiles on gogh: [https://github.com/Gogh-Co/Gogh]

I can add them to the list of the base16 palettes. These seem to overlap with the existing base16 palettes, but many themes are also missing in the existing palettes.

for example theme and corresponding number

and can be executed with a specific theme command like ble-theme-change=192

What is that number? Does the number 192 correspond to a color theme? If that is the case, is there a table that shows the correspondence between the themes and the numbers? I tried to find it in Gogh, but I do not seem to be able to find it. Also, why should we add an alternative interface for specifying a theme through the number, while we can already specify a theme through the name?

d4rkb4sh8 commented 2 weeks ago

In relation to Gogh numbers corresponding to themes once installed and run from the terminal it presents the user with theme names and corresponding numbers.

ble-opt color scheme is the short way of resolving I guess. first choose gogh profile then use that command to match the theme. But as you highlighted the color scheme palette may be too huge a body of work I guess. I was thinking a different approach since they have done the work in creating the profiles and RGB palettes that work that you may be able to utilise that and import those existing profiles.

Separate request is also color highlighting output feels like it should be an included feature like grc. https://github.com/garabik/grc with ble.sh so you become the all in one solution for prompt highlighting during input and output. Possibly merge the work they did as together would make ble.sh a bash input and output color solution. Unlike any other.

d4rkb4sh8 commented 2 weeks ago

BTW if it hasn't been said the community appreciates your work on ble.sh. Its awesome. Keep it up.

akinomyoga commented 2 weeks ago

can you add predefined themes based on the color profiles on gogh: [https://github.com/Gogh-Co/Gogh]

I can add them to the list of the base16 palettes. These seem to overlap with the existing base16 palettes, but many themes are also missing in the existing palettes.

I added theme in commit 16166c4777b38c9d750a9fc8947d823043c76ff5. You can now see the updated list for colorglass_base16_palette here.

In relation to Gogh numbers corresponding to themes once installed and run from the terminal it presents the user with theme names and corresponding numbers.

OK, I found an example in the animated GIF on README of Gogh. It seems these are just sequential numbers of the currently available themes, and it cannot be used as stable IDs of themes (i.e., the number is likely to be changed when new themes are added). Since ble.sh maintains its own list of themes, which also include other themes that are not found in Gogh, it doesn't seem to make sense to support that number. Anyway, you can specify a theme by its name.

Separate request is also color highlighting output feels like it should be an included feature like grc. https://github.com/garabik/grc with ble.sh so you become the all in one solution for prompt highlighting during input and output. Possibly merge the work they did as together would make ble.sh a bash input and output color solution. Unlike any other.

That project seems to be written in Python, but ble.sh is written in Bash. The reason for implementing everything in Bash is compatibility and portability, i.e., to achieve a consistent shell environment in any environment including the one where only Bash and POSIX are available. I will not add the dependency on Python.

Also, the targets of the two projects are completely different and orthogonal. They do not need to be combined. Or do you have anything that can be achieved only by combining them?

Maybe you might be thinking of importing the Bash syntax-highlighting implementation by grc, but I don't think their quality can be better than the implementation by ble.sh. ble.sh implements a full Bash parser in Bash. In addition, it also covers all the syntax changes from Bash 3.0 to 5.3-alpha (the parser behaves differently depending on the current Bash version). Also, it references the dynamic information (such as the shell options, the set variables and functions currently defined, etc.) to offer better highlighting. Such information cannot be obtained by external programs in general (there is actually a way, but it would be complicated and its performance would be bad).