Jump to content

RGB colors: 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:
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.
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.


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


Line 24: Line 24:
[[Category:Editorial annotations]]
[[Category:Editorial annotations]]
[[Category:Really simple]]
[[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
}