Skip to content

A live bird collage card for your Home Assistant dashboard.

Fixing colorize bugs - it works now!

ehpersonal3873bd2a4e2c67
diff --git a/homepage/views.php b/homepage/views.php
index 16e02b5a..1bbd6884 100644
--- a/homepage/views.php
+++ b/homepage/views.php
@@ -324,9 +324,9 @@ if(isset($_GET['view'])){
$diff_array = str_split($diff);
$indicators = array_map(function ($d) use ($delta) {
if ($d === '+') {
- return 'A';
+ return "<span style='color:lime;'><b>+</b></span>";
} elseif ($d === '-') {
- return 'B';
+ return "<span style='color:red;'><b>-</b></span>";
} elseif ($d === ' ') {
if ($delta !== '') {
return 'A';
@@ -342,13 +342,13 @@ if(isset($_GET['view'])){
// rejoin the modified lines into a string
$output = implode("\n", $lines);
- $results = $lines;
+ $results = $output;
if(strlen($results) == 0) {
$results = "This command has no output.";
}
- echo "<table style='min-width:70%;'><tr class='relative'><th>Output of command:`".$initcommand."`<button class='copyimage' style='right:40px' onclick='copyOutput(this);'>Copy</button></th></tr><tr><td><pre style='text-align:left'>$results</pre></td></tr></table>";
+ echo "<table style='min-width:70%;'><tr class='relative'><th>Output of command:`".$initcommand."`<button class='copyimage' style='right:40px' onclick='copyOutput(this);'>Copy</button></th></tr><tr><td style='padding-left: 0px;padding-right: 0px;padding-bottom: 0px;padding-top: 0px;'><pre class='bash' style='text-align:left;margin:0px'>$results</pre></td></tr></table>";
} else {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');