Home
Random
Log in
Settings
About LilyPond wiki
LilyPond wiki
Search
Editing
Colored arrow
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
This snippet demonstrates drawing colored arrows in a score, e.g. for analysis purposes. These arrows have a fixed length and angle. If you prefer arrows that adapt to layout changes, please also have a look at snippet 962. See also [[Colored arrow (2)]]. <lilypond version="2.24"> #(define-markup-command (Arrow layout props color angle length moveX moveY) (color? number? number? number? number?) (interpret-markup layout props #{ \markup { \with-dimensions #'(0 . 0) #'(0 . 0) \translate #(cons moveX moveY) \rotate #angle \override #'(thickness . 5) % line thickness \fontsize #10 % arrow-head size \with-dimensions #'(0 . 0) #'(0 . 0) \with-color $color \translate #(cons 0 (- 0 length)) \combine \draw-line #(cons 0 length) % can be replaced by \draw-dashed-line or \draw-dotted-line \translate-scaled #'(0 . -0.5) % might have to be adjusted if line thickness is changed \with-color $color \arrow-head #Y #DOWN ##t % ##t - filled arrow-head, ##f - empty arrow-head } #})) {<< \new Staff {R1*3} \new Staff { e'1-\tweak layer #-1 -\markup {\Arrow #green #138 #16 #2 #2 } e'1-\tweak layer #-1 -\markup {\Arrow #cyan #255 #14 #-1 #2 } e'1-\tweak layer #2 -\markup {\Arrow #red #172 #11 #1 #2 } % To have the arrow behind the staff, choose a value below 0 for the layer. % If you want the arrows to cover the notes, choose a value of 2 or more. } >>} </lilypond> [[Category:Education]] [[Category:Editorial annotations]] [[Category:Tweaks and overrides]] [[Category:Specific notation]] [[Category:Syntax and expressions]] [[Category:Snippet]]
Summary:
Please note that all contributions to LilyPond wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Meta:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)