Closed petrasovaa closed 3 days ago
It might be nice to have the output in a usable formats.
[
{
"value": 0,
"hex": "#FF0000",
"rgb": "rgb(255, 0, 0)",
"rgb": "rgb(255, 0, 0, 0)",
"hsl": "hsl(0, 100, 50)"
}
]
Hey, I was trying to look up this issue. Can you help me out a little? I want to know how I can test any changes I make to check their output.
[ { "value": 0, "hex": "#FF0000", "rgb": "rgb(255, 0, 0)", "rgb": "rgb(255, 0, 0, 0)", "hsl": "hsl(0, 100, 50)" } ]
Also, if you could provide a specific test that generates this output, I can use it to test my changes. Additionally, can you tell me how to test the changes overall, including some commands for integration tests?
Thanks for looking into this! I suggest to review r.colors.out documentation. You can try to write a simple test with pytest, see notes and look up some existing examples, e.g. in r.mask.status or v.dissolve. Similarly to r.mask.status example, you would create a small temporary raster and run r.colors.out on that one.
For the JSON support, look at some examples a GSoC student did this year to keep it consistent.
Add JSON output for easy parsing of r.colors.out output.
Describe the solution you'd like Adding option format, it would be something like format=plain for the current output format and format=json for the JSON output. There is a newly added parson library to GRASS (https://github.com/OSGeo/grass/pull/3028), so it should be used here.
See also discussion in https://github.com/OSGeo/grass/discussions/3019.
A test should be included. A possible JSON layout could be: