$R = $array_value[$k][0];
$G = $array_value[$k][1];
$B = $array_value[$k][2];
$denom = ($R - $G) * ($R - $G) + ($R - $B) * ($G - $B);
if($denom > 0)
{
$T = acos((($R - $G) + ($R - $B)) / sqrt($denom));
if($B > $G)
{
$T = 360 - $T;
}
$S = 1 - 3 * min($B, min($R, $G));
$I = ($R + $G + $B) / 3.0;
if($I > 0)
{
$array_poids[$k] = floor(0.5 + 10000 * $T * $S / $I);
}
}
else
{
$array_poids[$k] = 0;
}
<link rel="stylesheet" href="{% bower 'bootswatch/{theme}/bootstrap.min.css' theme=request.COOKIES.themeName|default:'yeti' %}" id="bootstrap-theme">
$('body').on('click', '#theme-dropdown .dropdown-menu li a', function(e) {
e.preventDefault();
var themeName = $(this).attr('data-theme');
var themeUrl = "{% bower 'bootswatch/{theme}/bootstrap.min.css' theme='{0}' %}".format(themeName);
$('#bootstrap-theme').attr('href', themeUrl);
Cookies.set('themeName', themeName, { expires: 365 });
});