MDAllowedValueSets/src/MDColorsSet.php

96 lines
2.2 KiB
PHP

<?PHP
/**
* Contains a class for controlling the list of base colors.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing available colors.
*/
final class MDColorsSet extends MDValueSet {
const COLOR_NAMES = [
"black",
"green",
"silver",
"lime",
"gray",
"olive",
"white",
"yellow",
"maroon",
"navy",
"red",
"blue",
"purple",
"teal",
"fuchsia",
"aqua",
];
const COLOR_NAMES_AND_EMPTY = [
'',
"black",
"green",
"silver",
"lime",
"gray",
"olive",
"white",
"yellow",
"maroon",
"navy",
"red",
"blue",
"purple",
"teal",
"fuchsia",
"aqua",
];
const COLORS_RGB = [
"black" => [0, 0, 0],
"green" => [0, 128, 0],
"silver" => [192, 192, 192],
"lime" => [0, 255, 0],
"gray" => [128, 0, 128],
"olive" => [128, 128, 0],
"white" => [255, 255, 255],
"yellow" => [255, 255, 0],
"maroon" => [128, 0, 0],
"navy" => [0, 0, 128],
"red" => [255, 0, 0],
"blue" => [0, 0, 255],
"purple" => [128, 0, 128],
"teal" => [0, 128, 128],
"fuchsia" => [255, 0, 255],
"aqua" => [0, 255, 255],
];
/**
* Gets an unsorted list of the entries in a translated version.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string>
*/
public static function getUnsortedList(MDTlLoader $tlLoader):array {
return parent::getTlUnsortedList($tlLoader, self::COLOR_NAMES, "colors_set", "colors_set");
}
/**
* Gets a list of the entries in a translated version.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string>
*/
public static function getSortedList(MDTlLoader $tlLoader):array {
return parent::getTlSortedList($tlLoader, self::COLOR_NAMES, "colors_set", "colors_set");
}
}