Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]

(no description)

File Size: 365 lines (13 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

brickfield_accessibility_color_test:: (7 methods):
  get_luminosity()
  luminosity()
  get_rgb()
  convert_color()
  get_wai_ert_contrast()
  get_wai_ert_brightness()
  get_wai_diffs()


Class: brickfield_accessibility_color_test  - X-Ref

Helper test base for tests dealing with color difference and luminosity.

get_luminosity(string $foreground, string $background)   X-Ref
Helper method that finds the luminosity between the provided
foreground and background parameters.

param: string $foreground The HEX value of the foreground color
param: string $background The HEX value of the background color
return: float The luminosity contrast ratio between the colors

luminosity(string $r, string $r2, string $g, string $g2, string $b, string $b2)   X-Ref
Returns the luminosity between two colors

param: string $r The first Red value
param: string $r2 The second Red value
param: string $g The first Green value
param: string $g2 The second Green value
param: string $b The first Blue value
param: string $b2 The second Blue value
return: float The luminosity contrast ratio between the colors

get_rgb(string $color)   X-Ref
Returns the decimal equivalents for a HEX color. Returns null if it cannot be determined.

param: string $color The hex color value
return: array|null An array where 'r' is the Red value, 'g' is Green, and 'b' is Blue

convert_color(string $color)   X-Ref
Converts multiple color or background styles into a simple hex string

param: string $color The color attribute to convert (this can also be a multi-value css background value)
return: string A standard CSS hex value for the color

get_wai_ert_contrast(string $foreground, string $background)   X-Ref
Returns the WAIERT contrast between two colors

param: string $foreground
param: string $background
return: array

get_wai_ert_brightness(string $foreground, string $background)   X-Ref
Returns the WAI ERT Brightness between two colors

param: string $foreground
param: string $background
return: float|int

get_wai_diffs(array $forergb, array $backrgb)   X-Ref
Get the wai differences.

param: array $forergb
param: array $backrgb
return: array