OpenSheetMusicDisplay
    Preparing search index...

    Function musicXmlColorToCss

    • MusicXML color attributes are #RRGGBB or #AARRGGBB (alpha first, see the MusicXML color data type). OSMD's options, model and renderer use CSS colors, where 8-digit hex is #RRGGBBAA (alpha last), because the strings are handed to SVG/canvas as they are.

      Converts #AARRGGBB to #RRGGBBAA. Any other string (#RRGGBB, named colors, undefined) is returned unchanged. With alphaLast (see [[musicXmlColorsAreAlphaLast]]), 8-digit colors are already #RRGGBBAA and are returned unchanged too.

      Parameters

      • color: string
      • alphaLast: boolean = false

      Returns string