Jump to content

RGB colors: Difference between revisions

From LilyPond wiki
No edit summary
m New category
Tags: Mobile edit Mobile web edit
 
Line 23: Line 23:


[[Category:Editorial annotations]]
[[Category:Editorial annotations]]
[[Category:Really simple]][[Category:Snippet]]
[[Category:Really simple]]
[[Category:Snippet]]

Latest revision as of 23:26, 21 November 2025

In addition to the built-in x11-color system, it is possible to get exact RGB colors by specifying the amounts of red, green and blue.

\version "2.24"

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

\relative c''{
  \override Staff.StaffSymbol.color = #(x11-color 'SlateBlue2)
  \set Staff.instrumentName = \markup {
    \with-color #(x11-color 'navy) Clarinet
  }

  %black
  \override Stem.color = #(rgb-color 0 0 0)
  gis8 a
  % white
  \override Stem.color = #(rgb-color 1 1 1)
  gis8 a
  % dark blue
  \override Stem.color = #(rgb-color 0 0 0.5)
  gis4 a
}