Sindbad~EG File Manager

Current Path : /home/beeson/public_html/WebMathXpert/ThreeBodyWeb/
Upload File :
Current File : //home/beeson/public_html/WebMathXpert/ThreeBodyWeb/NormalizeColor.php

<?php
function normalized_color($color) {
    // Trim any extra whitespace.
    $color = trim($color);

    // If already in "rgb(...)" format, return it as is.
    if (strpos($color, 'rgb(') === 0 && substr($color, -1) === ')') {
        return $color;
    }
    
    // Convert the input to lowercase for matching.
    $lowerColor = strtolower($color);
    
    // Mapping of common color names to their "rgb(...)" string representations.
    $colorNames = array(
        "black"      => "rgb(0,0,0)",
        "white"      => "rgb(255,255,255)",
        "red"        => "rgb(255,0,0)",
        "green"      => "rgb(0,128,0)",
        "blue"       => "rgb(0,0,255)",
        "yellow"     => "rgb(255,255,0)",
        "magenta"    => "rgb(255,0,255)",
        "cyan"       => "rgb(0,255,255)",
        "gray"       => "rgb(128,128,128)",
        "grey"       => "rgb(128,128,128)",
        "silver"     => "rgb(192,192,192)",
        "maroon"     => "rgb(128,0,0)",
        "olive"      => "rgb(128,128,0)",
        "purple"     => "rgb(128,0,128)",
        "teal"       => "rgb(0,128,128)",
        "navy"       => "rgb(0,0,128)",
        "orange"     => "rgb(255,165,0)",
        "pink"       => "rgb(255,192,203)",
        "brown"      => "rgb(165,42,42)",
        "gold"       => "rgb(255,215,0)",
        "violet"     => "rgb(238,130,238)",
        "indigo"     => "rgb(75,0,130)",
        "coral"      => "rgb(255,127,80)",
        "lime"       => "rgb(0,255,0)",
        "aqua"       => "rgb(0,255,255)",
        "turquoise"  => "rgb(64,224,208)",
        "salmon"     => "rgb(250,128,114)",
        "chocolate"  => "rgb(210,105,30)",
        "khaki"      => "rgb(240,230,140)",
        "plum"       => "rgb(221,160,221)",
        "orchid"     => "rgb(218,112,214)",
        "crimson"    => "rgb(220,20,60)",
        "beige"      => "rgb(245,245,220)",
        "linen"      => "rgb(250,240,230)",
        "tan"        => "rgb(210,180,140)",
        "azure"      => "rgb(240,255,255)",
        "ivory"      => "rgb(255,255,240)",
        "fuchsia"    => "rgb(255,0,255)",
        "gainsboro"  => "rgb(220,220,220)",
        "lavender"   => "rgb(230,230,250)",
        "mistyrose"  => "rgb(255,228,225)",
        "peachpuff"  => "rgb(255,218,185)",
        "seagreen"   => "rgb(46,139,87)",
        "sienna"     => "rgb(160,82,45)",
        "tomato"     => "rgb(255,99,71)",
        "wheat"      => "rgb(245,222,179)",
        "cornsilk"   => "rgb(255,248,220)"
    );
    
    // If the lowercased color exists in our mapping, return its rgb() representation.
    if (isset($colorNames[$lowerColor])) {
        return $colorNames[$lowerColor];
    }
    
    // If not recognized, you can choose to return a default value (e.g., black) or simply the original string.
    // Here we'll return the original string.
    return $color;
}
?>

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists