English 中文(简体)
Changing all the colors in Lilypond
原标题:

In Lilypond I can change the color of one type of object with a line like

override Staff.Clef # color = #(rgb-color 0.4 0.5 0.6)

I d like to have everything in the same (non-default) color, but I neither found a list of all the objects I could color nor did I find a command to change all the colors at once. Could anybody please point me to either?

问题回答

The LilyPond Snippet Repository has a solution that iterates through the list of objects contained in all-grob-descriptions:

#(define (override-color-for-all-grobs color)
  (lambda (context)
   (let loop ((x all-grob-descriptions))
    (if (not (null? x))
     (let ((grob-name (caar x)))
      (ly:context-pushpop-property context grob-name  color color)
      (loop (cdr x)))))))

% Example of usage:

elative c  {
  applyContext #(override-color-for-all-grobs (x11-color  blue))
  c4pp< d e f
  grace { g16[( a g fis]) } g1ff!
}

Note that this will change the color of every graphical object only if you run it in the proper context (Score, I think, will generally suffice), so you may need to do the following if you re in the middle of, say, a Voice context:

stopStaff
context Score
applyContext #(override-color-for-all-grobs (x11-color  blue))
startStaff

The list of graphical objects you need is at the bottom of this page. So a simple albeit tedious approach would be to iterate through all those objects you use, e.g.

override Staff.Clef     # color = #(rgb-color 0.4 0.5 0.6)
override Staff.NoteHead # color = #(rgb-color 0.4 0.5 0.6)
override Staff.Beam     # color = #(rgb-color 0.4 0.5 0.6)
override Staff.Slur     # color = #(rgb-color 0.4 0.5 0.6)

etc.

There s probably a much better way but I can t figure it out. Alternatively, as has been suggested before you could consider doing some post-processing on the output from Lilypond, which may be simpler depending on the tools you have available.

I strongly recommend that you read the excellent documentation, in particular how to navigate the Internals Reference as covered by the Learning Manual and the Notation Reference

Also you may obtain a better answer from the lilypond-user mailing list.





相关问题
Lilypond snippet for a separate coda

我不希望李利美,不要在乐团音乐的不常见之处,而是从狙击手存放处失踪,而不要看我的搜索词。 它基本上是除......外被 co死的 block脚石。

Shell Script to typeset Lilypond files with Textwrangler

I need a shell script which will allow me to typeset Lilypond files from TextWrangler (A Mac App). So far I have come up with this: #!/bin/sh /Applications/LilyPond.app/Contents/Resources/bin/...

Changing all the colors in Lilypond

In Lilypond I can change the color of one type of object with a line like override Staff.Clef # color = #(rgb-color 0.4 0.5 0.6) I d like to have everything in the same (non-default) color, but I ...

Lilypond Mac OS X build issue

I am trying to do a clean build of Lilypond on a clean install of Mac OS X. Dependencies have been installed using Brew. I do ./configure && make all in the Lilypond dir. It gets through the ...

Lilypond: Customize bar lines, recursively, automatically?

I m working on Carnatic music scores that involve complex time signatures, that will require modified bar lines Pattern for barlines for: 8/4 beats: 1 2 3 4 (dashed bar here) 5, 6 (Dotted Bar) 7, ...

Coloring notes in Lilypond by pitch

lilypond can color notes in a arbitrary way using override NoteHead # color = #red c with the default color is black. But I like to color all notes by pitch, so that my kids can more easily learn ...

热门标签