Code format
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
export const getSecurityColor = (security: number): string => {
|
||||
// Clamp security between -1 and 1
|
||||
const clampedSecurity = Math.max(-1, Math.min(1, security));
|
||||
|
||||
|
||||
// Define color points for specific security values
|
||||
const colorPoints = [
|
||||
{ sec: -1.0, color: [75, 0, 130] }, // Dark purple (same as 0.1)
|
||||
@@ -31,7 +31,7 @@ export const getSecurityColor = (security: number): string => {
|
||||
|
||||
// Calculate the ratio between the two points
|
||||
const ratio = (clampedSecurity - lowerPoint.sec) / (upperPoint.sec - lowerPoint.sec);
|
||||
|
||||
|
||||
// Interpolate between the colors
|
||||
const red = Math.round(lowerPoint.color[0] + (upperPoint.color[0] - lowerPoint.color[0]) * ratio);
|
||||
const green = Math.round(lowerPoint.color[1] + (upperPoint.color[1] - lowerPoint.color[1]) * ratio);
|
||||
|
||||
Reference in New Issue
Block a user