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 310 and 311] [Versions 39 and 311]

(no description)

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

Defines 1 class

Color:: (4 methods):
  rgb()
  throwIfInvalidColorComponentValue()
  convertColorComponentToHex()
  toARGB()


Class: Color  - X-Ref

Class Color
This class provides constants and functions to work with colors

rgb($red, $green, $blue)   X-Ref
Returns an RGB color from R, G and B values

param: int $red Red component, 0 - 255
param: int $green Green component, 0 - 255
param: int $blue Blue component, 0 - 255
return: string RGB color

throwIfInvalidColorComponentValue($colorComponent)   X-Ref
Throws an exception is the color component value is outside of bounds (0 - 255)

param: int $colorComponent
return: void

convertColorComponentToHex($colorComponent)   X-Ref
Converts the color component to its corresponding hexadecimal value

param: int $colorComponent Color component, 0 - 255
return: string Corresponding hexadecimal value, with a leading 0 if needed. E.g "0f", "2d"

toARGB($rgbColor)   X-Ref
Returns the ARGB color of the given RGB color,
assuming that alpha value is always 1.

param: string $rgbColor RGB color like "FF08B2"
return: string ARGB color