Jump to content

Coloring objects

From LilyPond wiki
Revision as of 22:38, 26 October 2025 by Jean Abou Samra (talk | contribs) (Import snippet from LSR)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

LilyPond gives you the ability to assign different colors to any grob in your score, such as NoteHeads, Alterations, Beams and so on, by simply overriding the #'color property and choosing your color (as explained in the Notation Reference, it is possible to obtain about any color).

\version "2.24.0"

%% http://lsr.di.unimi.it/LSR/Item?id=242


\relative c' {
  \override Accidental.color = #darkgreen
  \override Beam.color = #cyan
  \override NoteHead.color = #darkyellow
  c4
  \override NoteHead.color = #red
  f
  \override NoteHead.color = #darkmagenta
  g
  \override NoteHead.color = #darkblue
  b
  \override NoteHead.color = #green
  \override Stem.color = #blue
  e8 es d dis e4 r
}