Closed tomasfarias closed 3 years ago
FYI, my first attempt implemented RGB
variant as a tuple
struct
:
pub enum RawColor {
...
RGB(u8, u8, u8),
}
Since I expected the config to use an array, for example foreground = { rgb = [255, 10, 125] }
. But apparently toml
deserializing expects a table for tuple structs, not an array, so in order for deserialization to work the config would have had to look like foreground = { rgb = { 0 = 255, 1 = 10, 2 = 125} }
.
For that reason, I went with a regular struct as I think having r, g and b as the keys is more intuitive than 0, 1 and 2: foreground = { rgb = { r = 255, g = 10, b = 125} }
Edit: the { rgb = [255, 10, 125] }
format could be supported by RGB([u8; 3])
. I'm neutral between { rgb = [255, 10, 125] }
and { rgb = { r = 255, g = 10, b = 125} }
, so would like some input to decide.
I actually prefer the explicit struct with key names :slightly_smiling_face:
@dbrgn Thanks for the review! Let me know if the README update looks fine, or if there's anything more I should add or change.
Closes #147
Allows defining colors as ANSI codes or RGB in
config.toml
e.g.: