Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions packages/eui/src/components/mark/mark.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ export const Playground: Story = {
children: 'Marked text',
},
};

export const HighContrast: Story = {
...Playground,
tags: ['vrt-only'],
globals: { highContrastMode: true },
};
30 changes: 18 additions & 12 deletions packages/eui/src/components/mark/mark.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,29 @@
*/

import { css } from '@emotion/react';
import { UseEuiTheme, transparentize } from '../../services';
import { UseEuiTheme } from '../../services';
import { highContrastModeStyles } from '../../global_styling/functions/high_contrast';
import { euiScreenReaderOnly } from '../accessibility';

export const euiMarkStyles = ({ euiTheme, colorMode }: UseEuiTheme) => {
// TODO: Was $euiFocusBackgroundColor
const transparency = { LIGHT: 0.1, DARK: 0.3 };

export const euiMarkStyles = (euiThemeContext: UseEuiTheme) => {
const { euiTheme } = euiThemeContext;
return {
euiMark: css`
background-color: ${transparentize(
euiTheme.colors.primary,
transparency[colorMode]
)};
${highContrastModeStyles(euiThemeContext, {
// Override the browser's black color.
// Can't use 'inherit' because the text to background color contrast may not be sufficient
none: `
color: ${euiTheme.colors.text};
background-color: ${euiTheme.focus.backgroundColor};
`,
// `!important` is required here because some marked text links
// (e.g. EuiSideNav) will take precedence otherwise
preferred: `
color: ${euiTheme.colors.emptyShade} !important;
background-color: ${euiTheme.colors.primaryText};
Comment thread
mgadewoll marked this conversation as resolved.
`,
})}
font-weight: ${euiTheme.font.weight.bold};
/* Override the browser's black color.
Can't use 'inherit' because the text to background color contrast may not be sufficient */
color: ${euiTheme.colors.text};
`,
};
};
Expand Down