Add-On Documentation
  • Preparing search index...
  • The search index is not available
8Crafter's Server Utilities API
  • 8Crafter's Server Utilities API
  • Globals
  • modules
  • colorCore
  • getContrastRatio

Function getContrastRatio

  • getContrastRatio(
        color1: Globals.modules.colorCore.Color,
        color2: Globals.modules.colorCore.Color,
    ): number

    Calculates the contrast ratio between two colors according to WCAG 2.0.

    The contrast ratio is defined as (L1 + 0.05) / (L2 + 0.05), where L1 is the relative luminance of the lighter of the two colors, and L2 is the relative luminance of the darker of the two colors.

    Parameters

    • color1: Globals.modules.colorCore.Color

      The first color.

    • color2: Globals.modules.colorCore.Color

      The second color.

    Returns number

    A number representing the contrast ratio. The ratio can range from 1 to 21.

    • Defined in ../../../../AppData/Roaming/.minecraft_bedrock/installations/Main Release/packageData/development_behavior_packs/DebugSticksAndScreens/node_modules/color-core/dist/accessability/components/contrast-ratio.d.ts:13

Settings

Member Visibility
Add-On Documentation
8Crafter's Server Utilities API
  • Loading...

Generated using TypeDoc