web-music-score - v6.3.3
    Preparing search index...

    Class Paint

    Paint class for coloring music scores.

    Index

    Constructors

    Properties

    colors: Record<ColorKey, string> = ...
    default: Paint = ...

    Methods

    • Bind this paint to custom HTML element.

      Note (since 6.3.3): bindElement() no longer throws if bind fails, it returns false instead.

      Parameters

      • elem: string | HTMLElement

        HTML element id or element.

      Returns boolean

      • Boolean wheter bind was succesfull.
    • Get color.

      Parameters

      • colorKeyOrColor: string

        ColorKey or color.

      Returns string

      • Color value (e.g. "white" or "#FFFFFF").
    • Get color code.

      Parameters

      • colorKeyOrColor: string

        ColorKey or color.

      Returns string

      • Color code (e.g. "#FFFFFF").
    • Get color RGBA.

      Parameters

      • colorKeyOrColor: string

        ColorKey or color.

      Returns [number, number, number, number]

      • Color RGBA (e.g. [1, 1, 1, 1]).
    • Set color of any score document element. Use combination of color key parts to set color of specific elements.

      setColor("all", "red");                          // Set color of everything except background.
      setColor("staff", "red"); // Set color of all staff elements.
      setColor(["staff", "signature"], "red"); // Set color of all staff signature elements.
      setColor(["staff", "signature", "key"], "red"); // Set color of staff key signature.
      setColor(["staff", "signature", "time"], "red"); // Set color of staff time signature.
      setColor("staff.signature.time", "red"); // Set color of staff time signature.
      // etc.

      Parameters

      • colorKeyOrParts:
            | "hilight.staffpos"
            | "hilight.object"
            | "play.cursor"
            | "background"
            | "header.title"
            | "header.composer"
            | "header.arranger"
            | "rowgroup.instrument"
            | "rowgroup.frame"
            | "staff.frame"
            | "staff.note"
            | "staff.rest"
            | "staff.lyrics"
            | "staff.connective"
            | "staff.arpeggio"
            | "staff.signature.clef"
            | "staff.signature.key"
            | "staff.signature.time"
            | "staff.signature.tempo"
            | "staff.signature.measurenum"
            | "staff.element.fermata"
            | "staff.element.annotation"
            | "staff.element.navigation"
            | "staff.element.label"
            | "tab.frame"
            | "tab.note"
            | "tab.rest"
            | "tab.lyrics"
            | "tab.connective"
            | "tab.arpeggio"
            | "tab.tuning"
            | "tab.signature.clef"
            | "tab.signature.key"
            | "tab.signature.time"
            | "tab.signature.tempo"
            | "tab.signature.measurenum"
            | "tab.element.fermata"
            | "tab.element.annotation"
            | "tab.element.navigation"
            | "tab.element.label"
            | "staff"
            | "tab"
            | "tempo"
            | "fermata"
            | "note"
            | "connective"
            | "arpeggio"
            | "clef"
            | "header"
            | "label"
            | "time"
            | "title"
            | "tuning"
            | "key"
            | "composer"
            | "arranger"
            | "rowgroup"
            | "instrument"
            | "frame"
            | "rest"
            | "lyrics"
            | "signature"
            | "measurenum"
            | "element"
            | "annotation"
            | "navigation"
            | ColorKeyPart[]
            | "all"

        Color key parts to set color for.

      • color: string

        Color (HTML color code e.g. "green", "#AA6644", etc.)

      Returns Paint

    • Unbind this paint from custom HTML element.

      Note (since 6.3.3): unbindElement() no longer throws if bind fails, it returns false instead.

      Parameters

      • elem: string | HTMLElement

        HTML element id or element.

      Returns boolean

      • Boolean wheter unbind was succesfull.
    • Convert color name to color code.

      Parameters

      • colorName: string

        Color name (e.g. "white").

      Returns string

      • Color code (e.g. "#FFFFFF")
    • Convert color name ro RGBA.

      Parameters

      • colorName: string

        Color name (e.g. "white").

      • alpha: number = 1

        Alpha value 0..1 (default is 1).

      Returns [number, number, number, number]

      • RGBA (e.g. [1, 1, 1, 1]).