-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcolor_mode.php
40 lines (34 loc) · 924 Bytes
/
color_mode.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
$avail_modes = ["dark", "bright"];
$MODE = "bright";
if (isset($_GET["theme"]) && $_GET["theme"] == "dark") {
$MODE = "dark";
}
$colors_bright = [
"background" => [240, 240, 240],
"black" => [0, 0, 0],
"gray" => [190, 190, 190],
"red" => [190, 40, 40],
"blue" => [072, 118, 255],
"orange" => [255, 140, 0],
];
$colors_dark = [
"background" => [23, 23, 23],
"black" => [230, 230, 230],
"gray" => [100, 100, 100],
"red" => [190, 40, 40],
"blue" => [072, 118, 255],
"orange" => [255, 140, 0],
];
$all_colores = [
"dark" => $colors_dark,
"bright" => $colors_bright
];
define("_COLOR_MODE_", $MODE);
define("_COLOR_MODES_AVAIL_", $avail_modes);
define("_COLORS_ALL_", $all_colores);
function get_color_in_mode($im, string $identifier): false|int
{
$c = _COLORS_ALL_[_COLOR_MODE_][$identifier];
return imagecolorallocate($im, $c[0], $c[1], $c[2]);
}