I am developing my own cms with php and wanted to implement a color picker to change the color from the backend, but the problem is that i don't know how to generate the css with the new color value and when i open style.css the variables don't change.

What am i doing wrong? Is this the correct way to do it?

**generate.php**

```
$Color = "#000000";
$Background = "#555000";

$cssFile = file_get_contents('style.css');

$myfile = fopen("style.css", "w") or die("Unable to open file!");
fwrite($myfile, $cssFile);
fclose($myfile);

```

**style.css**

```
#header {
    background-color: $Background;
    width: 500px;
    height: 500px;
}
a {
    color: $Color;
}

```