lilypond-devel
[Top][All Lists]
Advanced

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

Re: Does anybody use x11-color ?


From: Reinhold Kainhofer
Subject: Re: Does anybody use x11-color ?
Date: Sat, 8 Dec 2007 14:55:48 +0100
User-agent: KMail/1.9.7

Am Samstag, 8. Dezember 2007 schrieb Till Rettig:
> Please have a look at the lilypond example I created using direct post
> script commands. It is an ugly hack, I suppose, but might illustrate
> what I am after. 

Hehe, you know the filled-box function in lilypond? Makes it a lot easier to 
write such an example. Attached are my humble attempts (actually my first 
real scheme programming steps!) to factorize the display out to a function 
(All you scheme expert out there, please correct the snippet so we can learn 
from your experience!):

~~~~~~~~~ BEGIN LY ~~~~~~~~~
\version "2.11.35"
\header {
  title = "Available X11 colors with examples"
}
#(define-markup-command (colorBox layout props color) (string?)
    "Print a box with the given x11-color as a markup. Syntax: \\colorBox 
#\"x11-color-name\""
    (interpret-markup layout props
      (markup #:with-color (x11-color color) #:filled-box (cons -0.5 10 ) 
(cons -1 3 ) #'1 color)
    )
)

\markup{\colorBox #"CornflowerBlue"}
\markup{\colorBox #"WhiteSmoke"}
\markup{\colorBox #"MistyRose"}
\markup{\colorBox #"DodgerBlue"}
\markup{\colorBox #"SteelBlue"}
\markup{\colorBox #"LightSteelBlue"}
\markup{\colorBox #"PaleTurquoise"}
~~~~~~~~~ END LY ~~~~~~~~~

Actually, the list of all available x11 colors is defined in x11-colors.scm, 
so one might even be able to map a lambda function on this list and 
automatically create the list of all colors without manually listing them...

Of course, the snippet should be extended to show the colors in three columns, 
too... And the spacing might be reduced, and ... (yeah, I'm obviously a 
perfectionist ;-) 

Cheers,
Reinhold

-- 
------------------------------------------------------------------
Reinhold Kainhofer, Vienna University of Technology, Austria
email: address@hidden, http://reinhold.kainhofer.com/
 * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/
 * K Desktop Environment, http://www.kde.org, KOrganizer maintainer
 * Chorvereinigung "Jung-Wien", http://www.jung-wien.at/

Attachment: colors.ly
Description: Text document

Attachment: colors.pdf
Description: Adobe PDF document


reply via email to

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