Arnau478 / hevi

Hex viewer
https://arnau478.github.io/hevi/
GNU General Public License v3.0
72 stars 3 forks source link

Custom color #6

Closed Arnau478 closed 4 months ago

Arnau478 commented 10 months ago

Right now, the color is hardcoded to yellow. It would be wise to allow the user to change this with a flag.

We should keep in mind how ANSI colors work. We might want the flag value to either be a color name (e.g. red) or a hex color. The first case would use color codes like ESC[33m while the latter would use ANSI truecolor.

We could of course implement some sort of truecolor detection, but that seems a bit overkill. Although I wanted to do something like that to set the --color default (#7)

Arnau478 commented 4 months ago

With the new concept of parsers, palettes where introduced, which makes this much easier and cleaner. The palette is hardcoded, however. So we just need to add a way to change the palette from the config. The problem is that involves a more advanced config parsing method that allows nested struct literals.

Reokodoku commented 4 months ago

Maybe we can use zon_get_fields for parse the config file.

Arnau478 commented 4 months ago

Looks good. I don't love the idea adding a dependency though. But I guess we can make an exception, as that's a temporary solution (we'll use std as soon as possible). If that ends up being the approach we take, I'll create an issue to stop using it, and wait for std support there.