Documentation

ContrastRatioValidator
in package

Validate contrast ratio. To validate at "Publish" time add it as `setting.validate_callback` to your customize setting.

Table of Contents

Properties

$currentlyDisabled  : mixed
$message  : mixed
$minimum  : mixed
$modifier  : mixed
$panel  : AbstractCustomizePanel
See `AbstractCustomizePanel`.
$setting1  : mixed
$setting2  : mixed

Methods

__construct()  : mixed
C'tor.
getLuminosity()  : mixed
Calculate luminosity of a given `#RRGGBB` string.
getLuminosityRatio()  : mixed
Calculate contrast ratio of two given `#RRGGBB` strings.
validate_callback()  : mixed
Validate minimum contrast ratio.

Properties

Methods

__construct()

C'tor.

public __construct(string $message, int $minimum, string $setting1, string $setting2, AbstractCustomizePanel $panel[, callable $modifier = null ]) : mixed
Parameters
$message : string

Localized message thrown to the customizer (two %s (ratio, minimum) are given)

$minimum : int
$setting1 : string

The setting ID to check against

$setting2 : string

The setting ID to check against

$panel : AbstractCustomizePanel
$modifier : callable = null

Allows you to modify the value for the settings at runtime

Tags
codeCoverageIgnore

validate_callback()

Validate minimum contrast ratio.

public validate_callback(WP_Error $validity) : mixed
Parameters
$validity : WP_Error

        
On this page

Search results