Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ansi-color-specifier? and ansi-color-specifier-list #679

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jpellegrini
Copy link
Contributor

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant