feat: gradient interpolation

This commit is contained in:
TrèsAbhi committed 2024-04-05 09:35:03 -05:00
1 parent 5d098c46fa
commit 4b54b61c35
1 file changed
+4 -7
+4 -7
View File
@@ -137,7 +137,8 @@ export default function Page() {
{values.map((value, index) => { {values.map((value, index) => {
const deltaPercentage = (value ?? 1) / (values[0] ?? 1) - 1; const deltaPercentage = (value ?? 1) / (values[0] ?? 1) - 1;
const significantChange = Math.abs(deltaPercentage) >= 0.15; const normalizedDeltaPercentage =
Math.abs(deltaPercentage) * 100 + 25;
return ( return (
<Table.Cell <Table.Cell
@@ -154,12 +155,8 @@ export default function Page() {
? value > values[0] ? value > values[0]
: value < values[0] : value < values[0]
) )
? significantChange ? `color-mix(in srgb, ${theme.colors.componentInteractiveActive_green} ${normalizedDeltaPercentage}%, ${theme.colors.componentInteractiveActive_green}00)`
? theme.colors.componentInteractiveActive_green : `color-mix(in srgb, ${theme.colors.componentInteractiveActive_red} ${normalizedDeltaPercentage}%, ${theme.colors.componentInteractiveActive_red}00)`,
: theme.colors.componentInteractive_green
: significantChange
? theme.colors.componentInteractiveActive_red
: theme.colors.componentInteractive_red,
}} }}
> >
<Flex <Flex