<?php
// get ID of the current document
$docID = $modx->resource->get('id');
// get the TV Color in the current doc
$tv = $modx->getObject('modTemplateVar',array('name'=>'Color'));
$newValue = "red";
// Set the tv Color with new value
$tv->setValue($docID, $newValue);
$tv->save();
?>