<?php

function prettyNumber($Number)
{
    return number_format(floor($Number), 0, ',', '.');
}

function colorNumber($Number, $ZeroToOrange = false)
{
    if($Number > 0)
    {
        return colorGreen($Number);
    }
    else if($Number < 0)
    {
        return colorRed($Number);
    }
    else
    {
        if($ZeroToOrange)
        {
            return colorOrange($Number);
        }
        return $Number;
    }
}

function prettyColorNumber($Number, $ZeroToOrange = false)
{
    if($Number > 0)
    {
        return colorGreen(prettyNumber($Number));
    }
    else if($Number < 0)
    {
        return colorRed(prettyNumber($Number));
    }
    else
    {
        if($ZeroToOrange)
        {
            return colorOrange(prettyNumber($Number));
        }
        return prettyNumber($Number);
    }
}

function colorRed($Number)
{
    return "<font color=\"#ff0000\">{$Number}</font>";
}

function colorGreen($Number)
{
    return "<font color=\"#00ff00\">{$Number}</font>";
}

function colorOrange($Number)
{
    return "<span style=\"color: orange;\">{$Number}</span>";
}

?>

<?php

function prettyNumber($Number)
{
    return number_format(floor($Number), 0, ',', '.');
}

function colorNumber($Number, $ZeroToOrange = false)
{
    if($Number > 0)
    {
        return colorGreen($Number);
    }
    else if($Number < 0)
    {
        return colorRed($Number);
    }
    else
    {
        if($ZeroToOrange)
        {
            return colorOrange($Number);
        }
        return $Number;
    }
}

function prettyColorNumber($Number, $ZeroToOrange = false)
{
    if($Number > 0)
    {
        return colorGreen(prettyNumber($Number));
    }
    else if($Number < 0)
    {
        return colorRed(prettyNumber($Number));
    }
    else
    {
        if($ZeroToOrange)
        {
            return colorOrange(prettyNumber($Number));
        }
        return prettyNumber($Number);
    }
}

function getColorHTMLValues() {
    return [
        'red' => '#ff0000',
        'green' => '#00ff00',
        'orange' => 'orange'
    ];
}

function getColorHTMLValue($colorName) {
    $values = getColorHTMLValues();

    return $values[$colorName];
}

function colorRed($Number) {
    $colorValue = getColorHTMLValue('red');
    return "<font color=\"{$colorValue}\">{$Number}</font>";
}

function colorGreen($Number) {
    $colorValue = getColorHTMLValue('green');
    return "<font color=\"{$colorValue}\">{$Number}</font>";
}

function colorOrange($Number) {
    $colorValue = getColorHTMLValue('orange');
    return "<span style=\"color: {$colorValue};\">{$Number}</span>";
}

?>

Define colors in a shared getter and add ability to get these specific color values
Define colors in a shared getter and add ability to get these specific color values
