Den tir. 30. jul. 2019 kl. 19.02 skrev Hendrik Boom <[email protected]
>:

> I've found this as an example for getting coloured text:
>
>     #lang scribble/base
>
>     @(require scribble/core)
>
>     @(define (colorize #:color c . content)
>         (elem #:style (style #f (list (color-property c)))
>               content))
>
>     @colorize[#:color "red"]{WARNING}
>
>
> But what if you want to call colorize from Racket code.
> For example, to make a function has the colour red built in,
> I tried
>
>     @(define (redtext text) (colorize #:color "red" text))
>
> which did not work.
>

You are right that the contents isn't a single string, so change it to:

@(define (redtext . contents)
   (colorize #:color "red" contents))

@redtext{foo}

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CABefVgyY1ED0HcbdXvvLGWxQO9j9AFBe99Db8uR16ieJL__J_A%40mail.gmail.com.

Reply via email to