Skip to content

Commit

Permalink
fixed to_ST return bug
Browse files Browse the repository at this point in the history
  • Loading branch information
s13k authored Jul 13, 2022
1 parent c50db4a commit 45d9d3d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Oklab/OkColor.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private static function find_cusp(float $a, float $b): array
$L_cusp = (1 / max(max($rgb_at_max[0], $rgb_at_max[1]), $rgb_at_max[2])) ** (1 / 3);
$C_cusp = $L_cusp * $S_cusp;

return [$L_cusp, $C_cusp];
return [ $L_cusp, $C_cusp ];
}

// Finds intersection of the line defined by
Expand Down Expand Up @@ -374,7 +374,7 @@ private static function to_ST(array $cusp): array
{
$L = $cusp[0];
$C = $cusp[1];
return [ 'S' => $C / $L, 'T' => $C / (1 - $L) ];
return [ $C / $L, $C / (1 - $L) ];
}

// Returns a smooth approximation of the location of the cusp
Expand All @@ -398,7 +398,7 @@ private static function get_ST_mid(float $a_, float $b_): array
)))
);

return [$S, $T];
return [ $S, $T ];
}

private static function get_Cs(float $L, float $a_, float $b_): array
Expand Down Expand Up @@ -431,7 +431,7 @@ private static function get_Cs(float $L, float $a_, float $b_): array
$C_0 = sqrt(1 / (1 / ($C_a * $C_a) + 1 / ($C_b * $C_b)));
}

return [$C_0, $C_mid, $C_max];
return [ $C_0, $C_mid, $C_max ];
}

public static function okhsl_to_srgb(float $h, float $s, float $l): array
Expand Down Expand Up @@ -529,7 +529,7 @@ public static function srgb_to_okhsl(float $r, float $g, float $b): array
}

$l = self::toe($L);
return [$h, $s, $l];
return [ $h, $s, $l ];
}

public static function okhsv_to_srgb(float $h, float $s, float $v): array
Expand Down Expand Up @@ -621,7 +621,7 @@ public static function srgb_to_okhsv(float $r, float $g, float $b): array
$v = $L / $L_v;
$s = ($S_0 + $T_max) * $C_v / (($T_max * $S_0) + $T_max * $k * $C_v);

return [$h, $s, $v];
return [ $h, $s, $v ];
}

}
}

0 comments on commit 45d9d3d

Please sign in to comment.