SheetXL - v0.8.0-beta.9+sites.210.e2d420901
    Preparing search index...

    Class Color

    Capabilities for working with colors.

    Advanced color customization and compatibility with CSS and Office color schemes.

    Key features include:

    • Accessing a collection of built-in colors (Named, Scheme, Index).
    • Creating customized colors with color adjustments.
    • Defining and and converting between different color models (RGB, HEX, HSL).

    IColor

    Implements

    Index
    • get "[toStringTag]"(): string

      Returns string

    • get isIColor(): true

      For runtime type checking.

      Returns true

    • Returns a new color that is derived from this color with the adjustments applied.

      Parameters

      • adjustments: Adjustment[]

        An array of Adjustments

      Returns IColor

    • For a system color, returns the authored fallback value (OOXML lastClr) as a 6-digit hex string (no leading #), or null if none. This is the value used when no IColor.SystemLookup resolves the color (e.g. headless rendering).

      Returns string | null

    • The base value for the color before adjustments.

      Returns string

    • Returns true if the other color will resolve to the same rgb values as this color.

      Parameters

      • other: any

        The other color to compare.

      Returns boolean

    • Returns the color as either 'black or white' depending on the luminance.

      Parameters

      • darkMode: boolean = false
      • threshold: number = 157

        The threshold to determine if the color is dark or light.

      Returns IColor

    • Return a string usable with CSS color properties.

      Parameters

      • mode: CSSMode = false

        false/true bake a concrete light/dark value — use when the output leaves live CSS (clipboard HTML, export, canvas). 'adaptive' emits a light-dark() expression the browser re-resolves from the subtree's color-scheme — a light/dark flip needs no re-render (renderers should prefer this; see IColor.CSSMode).

      • alpha: boolean = false

        If true alpha will be applied.

      Returns string

    • Return a HEX with adjustments applied.

      Parameters

      • darkMode: boolean = false

      Returns HEX

    • Return as HSLA with adjustments applied.

      Parameters

      • darkMode: boolean = false

      Returns HSLA

    • Return as RGBA with adjustments applied.

      Parameters

      • darkMode: boolean = false

      Returns RGBA

    • Return the color as a string.

      Returns string

    • Returns the default color scheme lookup that Colors will use if none is provided.

      Returns SchemeLookup

    • Returns the built-in (baked) values for the system colors as a map of ${name} (lower-case) -> #RRGGBB.

      Returns Record<string, string>

      These are the hardcoded system color definitions. A host renderer (@sheetxl/react) uses them to seed the default --sxl-sys-color-* CSS variables (which Color.toCSS references); a host then overrides those variables to theme the grid.

    • The current system-color epoch. Consumers that cache resolved system colors (such as a document Theme) can compare against this to know when to re-resolve.

      Returns number

    • Invalidates cached system-color resolutions (call when the host theme changes but the lookup function itself stays the same, e.g. CSS variables were updated).

      Returns void

    • Returns true if the named color is a system color (e.g. windowText, window, btnFace).

      Parameters

      • name: string

      Returns boolean

      System colors are environment-dependent and are candidates for host theming (see IColor.SystemLookup). Non-system named colors (e.g. red) and transparent return false.

    • Sets the global default IColor.SystemLookup used to resolve system colors (e.g. windowText, window) when no per-color lookup is supplied.

      Parameters

      • lookup: SystemLookup | null

        The lookup to install, or null to clear.

      Returns SystemLookup | null

      The previous lookup.

      A host (for example the VSCode extension) calls this once to theme the rendered grid. Passing null restores the built-in baked values. This bumps the system epoch so cached resolutions are refreshed.