Skip to content

Commit 1ac49f4

Browse files
committed
Add colorscheme card/preview php page
1 parent d748bc4 commit 1ac49f4

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

colors.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
$colors = json_decode(file_get_contents('colors.json'), true);
3+
4+
echo '<!DOCTYPE html><html><head><meta charset="utf-8">';
5+
echo '<style>
6+
body {
7+
font-family: sans-serif;
8+
background: #f9f9f9;
9+
color: #333;
10+
}
11+
table {
12+
border-collapse: collapse;
13+
margin: 1em 0;
14+
}
15+
td {
16+
width: 36px;
17+
height: 36px;
18+
text-align: center;
19+
vertical-align: middle;
20+
font-family: sans-serif;
21+
font-size: 1.1em;
22+
font-weight: 700;
23+
border: 1px solid #ccc;
24+
}
25+
h2 {
26+
font-size: 1.3em;
27+
font-weight: 700;
28+
margin-top: 2em;
29+
}
30+
</style>';
31+
echo '</head><body>';
32+
33+
echo '<h1>LTO Barcode Color Schemes</h1>';
34+
35+
foreach ($colors as $paletteName => $palette) {
36+
echo "<h2>Palette: " . htmlspecialchars($paletteName) . "</h2>";
37+
echo "<table><tr>";
38+
39+
$textColor = (strtoupper($paletteName) === 'INV') ? '#fff' : '#000';
40+
41+
foreach ($palette as $char => $rgb) {
42+
$bgColor = sprintf("rgb(%d,%d,%d)", $rgb[0], $rgb[1], $rgb[2]);
43+
echo "<td style=\"background-color: $bgColor; color: $textColor;\">" . htmlspecialchars($char) . "</td>";
44+
}
45+
46+
echo "</tr></table>";
47+
}
48+
49+
echo '</body></html>';
50+

0 commit comments

Comments
 (0)