Jump to content

Coloring objects: Difference between revisions

From LilyPond wiki
Import snippet from LSR
 
m New category
Tags: Mobile edit Mobile web edit
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
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).
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).


<lilypond version="2.24.0">
<lilypond version="2.24">
%% http://lsr.di.unimi.it/LSR/Item?id=242
%% http://lsr.di.unimi.it/LSR/Item?id=242


Line 28: Line 28:
[[Category:Really simple]]
[[Category:Really simple]]
[[Category:Really cool]]
[[Category:Really cool]]
[[Category:Snippet]]

Latest revision as of 23:14, 21 November 2025

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"

%% 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
}