The Twig CssColorFromString bundle extends Twig with a simple filter converting strings to a css color.