lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Colors in alists


From: Urs Liska
Subject: Re: Colors in alists
Date: Wed, 05 Nov 2014 07:31:59 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.6.0


Am 05.11.2014 00:02, schrieb Thomas Morley:
2014-11-04 19:05 GMT+01:00 Urs Liska <address@hidden>:
Am 04.11.2014 15:47, schrieb Jay Anderson:
On Tue, Nov 4, 2014 at 3:48 AM, Urs Liska <address@hidden> wrote:
I want to store colors in an alist like

#(define types
'(("one" . "red")
("two" . "blue")))

I can retrieve and display the values with assoc-ref but I don't know how
to
turn the returned string into a color to be used in an override.
Try quasiquote + unquote:

#(define types
    `(("one" . ,red)
      ("two" . ,blue)))

#(display types) => ((one 1.0 0.0 0.0) (two 0.0 0.0 1.0))

-----Jay

Hi Jay,

thanks, that was it. Still a mystery, this all ...

I would be extremely happy if someone could take the time and write a
slow-paced tutorial about this on Scores of Beauty!

Best
Urs


_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user
As others pointed out it's a matter of quote/unquote/quasiquote,
though for completeness, there is some lilypond function which can
make your initial approach work:


#(define clrs
'(("one" . "red")
   ("two" . "blue")))

#(display (color? (x11-color (assoc-get "one" clrs))))
#(display (x11-color (assoc-get "one" clrs)))


Cheers,
   Harm

Thanks for that hint. I *did* try that function but only in the definition, where it didn't work.

Urs



reply via email to

[Prev in Thread] Current Thread [Next in Thread]