Skip to content

Commit

Permalink
Adding customColor to className
Browse files Browse the repository at this point in the history
  • Loading branch information
miukimiu committed Jul 25, 2022
1 parent 0f34784 commit d026372
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/token/__snapshots__/token.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exports[`EuiToken is rendered 1`] = `

exports[`EuiToken props color can be a custom hex 1`] = `
<span
class="euiToken emotion-euiToken-circle-light-s"
class="euiToken css-12d11bg-customColor-euiToken-circle-light-s"
style="color:#000000;background-color:#FF0000"
>
<span
Expand Down
3 changes: 2 additions & 1 deletion src/components/token/token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,14 @@ export const EuiToken: FunctionComponent<EuiTokenProps> = ({
if (isTokenColor) {
cssStyles = [styles[finalColor as TokenColor], ...cssStyles];
} else if (finalFill === 'none') {
// when custom color is used, we passed it in the style prop
cssStyles = [styles.customColor, ...cssStyles];
finalStyle = { color: finalColor, ...style };
} else {
const isFinalColorDark = isColorDark(...hexToRgb(finalColor));
const lightOrDarkColor = isFinalColorDark ? '#FFFFFF' : '#000000';

cssStyles = [styles.customColor, ...cssStyles];

finalFill = 'dark';
finalStyle = {
color: lightOrDarkColor,
Expand Down

0 comments on commit d026372

Please sign in to comment.