diff --git a/packages/grafana-ui/src/components/ColorPicker/ColorSwatch.tsx b/packages/grafana-ui/src/components/ColorPicker/ColorSwatch.tsx index e63572c5aca..a00b2492a71 100644 --- a/packages/grafana-ui/src/components/ColorPicker/ColorSwatch.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/ColorSwatch.tsx @@ -82,6 +82,9 @@ const getStyles = ( '&:hover': { transform: 'scale(1.1)', }, + '@media (forced-colors: active)': { + forcedColorAdjust: 'none', + }, }), }; }; diff --git a/packages/grafana-ui/src/components/VizLegend/SeriesIcon.tsx b/packages/grafana-ui/src/components/VizLegend/SeriesIcon.tsx index 937f61bf836..ca7e8c3b433 100644 --- a/packages/grafana-ui/src/components/VizLegend/SeriesIcon.tsx +++ b/packages/grafana-ui/src/components/VizLegend/SeriesIcon.tsx @@ -1,8 +1,9 @@ +import { css, cx } from '@emotion/css'; import React, { CSSProperties } from 'react'; import { fieldColorModeRegistry } from '@grafana/data'; -import { useTheme2 } from '../../themes'; +import { useTheme2, useStyles2 } from '../../themes'; export interface Props extends React.HTMLAttributes { color?: string; @@ -12,6 +13,8 @@ export interface Props extends React.HTMLAttributes { export const SeriesIcon = React.memo( React.forwardRef(({ color, className, gradient, ...restProps }, ref) => { const theme = useTheme2(); + const styles2 = useStyles2(getStyles); + let cssColor: string; if (gradient) { @@ -35,8 +38,24 @@ export const SeriesIcon = React.memo( marginRight: '8px', }; - return
; + return ( +
+ ); }) ); +const getStyles = () => ({ + forcedColors: css` + @media (forced-colors: active) { + forced-color-adjust: none; + } + `, +}); + SeriesIcon.displayName = 'SeriesIcon';