Полагаю, вы могли бы вернуть свои ключевые кадры из функции, которая принимает реквизиты в качестве аргумента:
const getChangeColor = (props) => keyframes`
0% {
color: ${props.theme.color.somecolor};
}
100% {
color: ${props.theme.color.somecolor};
}
`;
..., а затем передать реквизиты в функцию при вызове:
const ColorChange = css`
-webkit-animation: ${props => getChangeColor(props)} 3s infinite;
-moz-animation: ${props => getChangeColor(props)} 3s infinite;
-o-animation: ${props => getChangeColor(props)} 3s infinite;
-ms-animation: ${props => getChangeColor(props)} 3s infinite;
animation: ${props => getChangeColor(props)} 3s infinite;
`;
... или, чтобы упростить:
const ColorChange = css`
-webkit-animation: ${getChangeColor} 3s infinite;
-moz-animation: ${getChangeColor} 3s infinite;
-o-animation: ${getChangeColor} 3s infinite;
-ms-animation: ${getChangeColor} 3s infinite;
animation: ${getChangeColor} 3s infinite;
`;
... или, возможно, даже сократить количество вызовов функций:
const ColorChange = css`
${props => {
const changeColor = getChangeColor(props);
return `
-webkit-animation: ${changeColor} 3s infinite;
-moz-animation: ${changeColor} 3s infinite;
-o-animation: ${changeColor} 3s infinite;
-ms-animation: ${changeColor} 3s infinite;
animation: ${changeColor} 3s infinite;
`;
}}
`;
Надеюсь, это поможет.