redistribute() — react Function Reference
Architecture documentation for the redistribute() function in colors.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD ee081260_449d_84ad_5026_a19cf2b056fe["redistribute()"] cd44b2f4_e759_ad24_8a24_5b5554de8cae["Color"] ee081260_449d_84ad_5026_a19cf2b056fe -->|defined in| cd44b2f4_e759_ad24_8a24_5b5554de8cae 48de4b36_a395_77eb_d306_9a2f85af90c0["adjusted()"] 48de4b36_a395_77eb_d306_9a2f85af90c0 -->|calls| ee081260_449d_84ad_5026_a19cf2b056fe style ee081260_449d_84ad_5026_a19cf2b056fe fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/react-forgive/client/src/colors.ts lines 46–59
private static redistribute([r, g, b]: RGB): RGB {
const threshold = 255.999;
const max = Math.max(r, g, b);
if (max <= threshold) {
return [int(r), int(g), int(b)];
}
const total = r + g + b;
if (total >= 3 * threshold) {
return [int(threshold), int(threshold), int(threshold)];
}
const x = (3 * threshold - total) / (3 * max - total);
const gray = threshold - x * max;
return [int(gray + x * r), int(gray + x * g), int(gray + x * b)];
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does redistribute() do?
redistribute() is a function in the react codebase, defined in compiler/packages/react-forgive/client/src/colors.ts.
Where is redistribute() defined?
redistribute() is defined in compiler/packages/react-forgive/client/src/colors.ts at line 46.
What calls redistribute()?
redistribute() is called by 1 function(s): adjusted.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free