Fix: Animated scrollbar renders black in NO_COLOR mode (#13188)

This commit is contained in:
Jacob Richman
2025-11-16 20:45:07 -08:00
committed by GitHub
parent a74d1943e3
commit 4b2ad38c13
9 changed files with 202 additions and 44 deletions
@@ -0,0 +1,32 @@
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type React from 'react';
import { Text, type TextProps } from 'ink';
import Gradient from 'ink-gradient';
import { theme } from '../semantic-colors.js';
export const ThemedGradient: React.FC<TextProps> = ({ children, ...props }) => {
const gradient = theme.ui.gradient;
if (gradient && gradient.length >= 2) {
return (
<Gradient colors={gradient}>
<Text {...props}>{children}</Text>
</Gradient>
);
}
if (gradient && gradient.length === 1) {
return (
<Text color={gradient[0]} {...props}>
{children}
</Text>
);
}
return <Text {...props}>{children}</Text>;
};