inverter.js
function fixGradient(str) {
  var ret = str.replace(GRADIENT_REPLACE_RE, function($0, $1, $2){
    return $1 ?
      $0 :
      ($2 == 'right') ?
        'left' :
        ($2 == 'left') ?
          'right' :
          (parseInt($2) % 180 == 0) ?
            $2 :
            ($2.substr(0,1) == '-') ?
              $2.substr(1) :
              ('-' + $2);
    });
  return ret;
}
function fixGradient(str) {
  var ret = str.replace(GRADIENT_REPLACE_RE, function($0, $1, $2){
    return $1 ?
      $0 :
      ($2 == 'right') ?
        'left' :
        ($2 == 'left') ?
          'right' :
          (parseInt($2) % 180 == 0) ?
            $2 :
            ($2.substr(0,1) == '-') ?
              $2.substr(1) :
              ('-' + $2);
    });
  return ret;
}
function fixGradient ( str ) { var ret = str . replace ( GRADIENT_REPLACE_RE , function ( $0 , $1 , $2 ) { return $1 ? $0 : ( $2 == 'right' ) ? 'left' : ( $2 == 'left' ) ? 'right' : ( parseInt ( $2 ) % 180 == 0 ) ? $2 : ( $2 . substr ( 0 , 1 ) == '-' ) ? $2 . substr ( 1 ) : ( '-' + $2 ) ; } ) ; return ret ; }
Fixes most gradient definitions

Replaces `left` with `right`, `X(X(X))deg` to `-X(X(X))deg`, and the opposites

fixGradient("-webkit-gradient(linear, left bottom, right top, color-stop(0%,#000), color-stop(100%,#fff))")
-> "fixGradient("-webkit-gradient(linear, right bottom, left top, color-stop(0%,#000), color-stop(100%,#fff))")"
fixGradient("background: linear-gradient(45deg, #000 0%, #fff 100%)")
-> "linear-gradient(-45deg, #000 0%,#fff 100%)"
Fixes most gradient definitions