conditionally update css on edit.php

Your code is badly broken and it is going to be an awkward process to hack the styles in like you are trying to do. It looks like you are using some third part code but assuming that that code uses WP_List_Table as it probably should you can alter the CSS of the rows as they are generated:

function alter_list_table_css_wpse_192010($classes) {
  if (is_admin() && in_array('iedit',$classes)) {
    // define your colors
    $colors = array(
      'red', 'pink', 'orange', 'light-orange', 'green'
    );
    // pull in the post data
    global $post;
    // var_dump($classes,$post->post_date);
    // do your date math
    // and add your classes
    $classes[] = 'date-bg-'.$colors[0];
  }
  return $classes;
}
add_action(
  'post_class',
  'alter_list_table_css_wpse_192010',
  10,3
);

Then, all you have to do is add CSS for the five different backgrounds, but you know what the classes are so there is no tricky logic involved.

Caveats:

  1. I don’t know quite what your date math is supposed to look like so I
    didn’t try to write that part.
  2. I don’t know exactly what date you are trying to use. It looks to be
    non-Core.
  3. I grepped my install and the iedit class appears only once in Core
    in the list table so I am using it to identify our presence in that
    table. It is a bit of a hack.