改变 Lilypond 中的所有颜色

发布于 2024-10-24 00:29:14 字数 197 浏览 1 评论 0原文

的行来更改一种类型的对象的颜色,

在 Lilypond 中,我可以使用类似\override Staff.Clef #'color = #(rgb-color 0.4 0.5 0.6)

我希望将所有内容都包含在相同(非默认)颜色,但我既没有找到可以着色的所有对象的列表,也没有找到立即更改所有颜色的命令。有人可以指点我吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

只怪假的太真实 2024-10-31 00:29:14

LilyPond 片段存储库 有一个 迭代 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:
\relative c' {
  \applyContext #(override-color-for-all-grobs (x11-color 'blue))
  c4\pp\< d e f
  \grace { g16[( a g fis]) } g1\ff\!
}

请注意,这将更改仅当您在适当的上下文中运行每个图形对象的颜色时(我认为,通常就足够了),因此如果您处于中间,您可能需要执行以下操作,一个 Voice 上下文:

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

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:
\relative c' {
  \applyContext #(override-color-for-all-grobs (x11-color 'blue))
  c4\pp\< d e f
  \grace { g16[( a g fis]) } g1\ff\!
}

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
轻许诺言 2024-10-31 00:29:14

您需要的图形对象列表位于此页面的底部。因此,一个简单但乏味的方法是迭代您使用的所有对象,例如

\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)

等。

可能有更好的方法,但我无法弄清楚。或者,按照之前的建议您可以考虑对 Lilypond 的输出进行一些后处理,这可能会更简单,具体取决于您可用的工具。

我强烈建议您阅读优秀的文档,特别是如何导航 学习手册符号参考

另外,您还可以从 lilypond- 获得更好的答案用户邮件列表

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文