Enable advanced color modes in screen/put-string #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reasoning
I'm poking around roguelike design in clojure, using clojure-lanterna. I wanted to specify the RGB colors drawn, and use more advanced features in the underlying library.
Features
Implementation
I have a few questions relating to implementation I'd like to see before this is merged.
put-string
is likely to be called a lot, I'm considering adding a core.cache to it, so that we aren't parsing the same string over and over in a hot loop. (This was partially why I setup the TextColor passthrough, to allow users to optimize.) I have no benchmarks, but it is a concern. I also considered a protocol, to allow for faster dispatch, but that felt heavyhanded for a first go.IllegalArgumentException
, then an error from trying to type-hint the first exception. Between that and the exception making the default return ofTextColor$ANSI/DEFAULT
no longer guaranteed, it makes me wonder if I should catch and suppress the error.