Add ansi-color-specifier?
and ansi-color-specifier-list
#679
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.
So the user can check if an object is one of the symbols that specify ANSI colors. This can be useful when writing code that takes those as argument:
(define-method ascii-draw ((s <shape>) color) ;; we should check if color is a valid color here ... )
And... Since we're at it, why not add a method to obtain the full list also? :)
(ansi-color-specifier-list) => (normal bold no-bold italic no-italic underline no-underline blink no-blink reverse no-reverse black bg-black red bg-red green bg-green yellow bg-yellow blue bg-blue magenta bg-magenta cyan bg-cyan white bg-white)
In order to do this, we include the
set!
s of all lambdas that define procedures for ANSI color stuff under the lambda that defines the color alist.@egallesio I actually have one example (for the
examples
subdirectory) that would use this... That's why I am proposing this PR.