lsd icon indicating copy to clipboard operation
lsd copied to clipboard

Add support for specifying theme colors as hex colors

Open khughitt opened this issue 3 years ago • 5 comments

Greetings!

Is there any possibility that lsd could be extended so that theme colors could be specified using hex (or rgb, etc.)?

XTerm color codes are generally awkward to work with and make it difficult to use something like pywal to manage LSD's colors.

Thanks for all of your work on lsd so far! It's been fun to use.

khughitt avatar Apr 09 '22 19:04 khughitt

This would be a good addition, but the changes would probably be in https://github.com/crossterm-rs/crossterm as we are relying on crossterm to deserialize.

meain avatar Apr 10 '22 12:04 meain

Sounds good! It looks like crossterm might already supporting specifying colors as RGB triplets?

https://docs.rs/crossterm/latest/crossterm/style/enum.Color.html

That would already be quite useful. Supporting hex on top of that would just be a bonus, but probably would not be too much work. One could perhaps use the conversion functionality from something like colorsys.rs?

khughitt avatar Apr 10 '22 13:04 khughitt

Yup, you can actually give RGB like [30,30,30] and that is possible in the theme config.

About the actual hex parsing implementation, I think it would be better to discuss about it in crossterm. I am assuming they would be happy to have deserialize from hex or maybe even hsl.

meain avatar Apr 10 '22 15:04 meain

hi @khughitt, try the following theme config for RGB:

user:
- 30
- 30
- 30

zwpaper avatar Apr 11 '22 08:04 zwpaper

Thanks! Heh, that almost does the trick. pywal does support writing out individual RGB triplet elements via user template modifiers (although this functionality appears to possibly be broken in the current release, 3.3.0), however, it writes on RGB floats.

khughitt avatar Apr 16 '22 22:04 khughitt

fixed by https://github.com/lsd-rs/lsd/pull/889

/close

zwpaper avatar Aug 30 '23 07:08 zwpaper

@zwpaper: Closing this issue.

In response to this:

fixed by https://github.com/lsd-rs/lsd/pull/889

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

muniu-bot[bot] avatar Aug 30 '23 07:08 muniu-bot[bot]