Closed jonathanabennett closed 6 years ago
New PR with README commit removed.
Thank you.
Now I must ask: have you tested this?
If I'm honest I would prefer if this code took a Color
type from the stdlib colors
module but that would clash with the Color
type defined by this module :(
Perhaps adding a little documentation comment on how to pass colours would be enough, 0xFF1234
right?
Yes, I have tested this. It's currently handling the terrain colors in a roguelike I'm working on. I will keep hacking at this because I'm unhappy having to guess at color codes myself. It also gives me a chance to familiarize myself with a bit of Nim that I don't expect to use in my current code.
Termbox takes 256 color numbers, as seen here. The numbers that Termbox (and therefore nimbox) use are the color immediately beside the swatch. We should be able to make stdlib colors
work by using explicit namespace, correct? I will write examples/256colors.nim
as documentation tomorrow and submit it as an additional pull request.
I've written a test. If you can test it on your machine and see if it works, that would be great. It's in the same format as the others (only displaying for 1 second before closing). I don't like that, but I kept it consistent with the style of the others.
Okay, this should be good. Thanks!
This commit addresses issue #2. It adds 256 color support very naively. It does not check for terminal support of 256 colors. It does not check that the int provided is in the range 0..255. It does not have any error checking or handling of any sort.
Fixes: #2