We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eb0c241 commit 71eae08Copy full SHA for 71eae08
webapp/src/Utils/Utils.php
@@ -350,12 +350,16 @@ public static function convertToColor(string $hex): ?string
350
public static function parseHexColor(string $hex): array
351
{
352
// Source: https://stackoverflow.com/a/21966100
353
- $length = (strlen($hex) - 1) / 3;
+ $length = (strlen($hex) - 1) / 4;
354
+ if (((strlen($hex) - 1) % 3) == 0) {
355
+ $length = (strlen($hex) - 1) / 3;
356
+ }
357
$fact = [17, 1, 0.062272][$length - 1];
358
return [
359
(int)round(hexdec(substr($hex, 1, $length)) * $fact),
360
(int)round(hexdec(substr($hex, 1 + $length, $length)) * $fact),
- (int)round(hexdec(substr($hex, 1 + 2 * $length, $length)) * $fact)
361
+ (int)round(hexdec(substr($hex, 1 + 2 * $length, $length)) * $fact),
362
+ (int)round(hexdec(substr($hex, 1 + 3 * $length, $length)) * $fact)
363
];
364
}
365
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments