@elastic/eui
Version:
Elastic UI Component Library
29 lines (28 loc) • 1.77 kB
JavaScript
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { css } from '@emotion/react';
import { highContrastModeStyles } from '../../global_styling/functions/high_contrast';
import { euiScreenReaderOnly } from '../accessibility';
export var euiMarkStyles = function euiMarkStyles(euiThemeContext) {
var euiTheme = euiThemeContext.euiTheme;
return {
euiMark: /*#__PURE__*/css(highContrastModeStyles(euiThemeContext, {
// Override the browser's black color.
// Can't use 'inherit' because the text to background color contrast may not be sufficient
none: "\n color: ".concat(euiTheme.colors.textParagraph, ";\n background-color: ").concat(euiTheme.components.markBackground, ";\n "),
// `!important` is required here because some marked text links
// (e.g. EuiSideNav) will take precedence otherwise
preferred: "\n color: ".concat(euiTheme.colors.emptyShade, " !important;\n background-color: ").concat(euiTheme.colors.backgroundFilledPrimary, ";\n ")
}), " font-weight:", euiTheme.font.weight.bold, ";;label:euiMark;")
};
};
export var euiMarkScreenReaderStyles = function euiMarkScreenReaderStyles(highlightStart, highlightEnd) {
return {
hasScreenReaderHelpText: /*#__PURE__*/css("&::before,&::after{", euiScreenReaderOnly(), ";}&::before{content:' [", highlightStart, "] ';}&::after{content:' [", highlightEnd, "] ';};label:hasScreenReaderHelpText;")
};
};