You've already forked Epicnabbo-Catalogus-Updated-Daily
🆙 More fixes 🆙
This commit is contained in:
@@ -13,6 +13,25 @@ if (! function_exists('setting')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('isDarkColor')) {
|
||||
function isDarkColor(?string $hex): bool
|
||||
{
|
||||
if (! is_string($hex)) {
|
||||
return false;
|
||||
}
|
||||
$hex = trim($hex);
|
||||
if (! preg_match('/^#?[0-9a-fA-F]{6}$/', $hex)) {
|
||||
return false;
|
||||
}
|
||||
$hex = ltrim($hex, '#');
|
||||
$r = hexdec(substr($hex, 0, 2));
|
||||
$g = hexdec(substr($hex, 2, 2));
|
||||
$b = hexdec(substr($hex, 4, 2));
|
||||
$luminance = (0.2126 * $r + 0.7152 * $g + 0.0722 * $b) / 255;
|
||||
return $luminance < 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('hasPermission')) {
|
||||
function hasPermission(string $permission): string
|
||||
{
|
||||
@@ -94,4 +113,4 @@ if (! function_exists('dropForeignKeyIfExists')) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user