Prometheus/Loki: Improve metric search highlight contrast (#49384)

* Prometheus/Loki: Improve metric search highlight contrast

* Update other places, and add reusable variables
pull/49415/head
Torkel Ödegaard 3 years ago committed by GitHub
parent 4ea0b39db1
commit c29e6fcb3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      packages/grafana-data/src/themes/createComponents.ts
  2. 4
      packages/grafana-ui/src/components/BrowserLabel/Label.tsx
  3. 4
      packages/grafana-ui/src/components/Logs/LogRowMessage.tsx
  4. 9
      packages/grafana-ui/src/components/Logs/getLogRowStyles.ts
  5. 6
      packages/grafana-ui/src/themes/GlobalStyles/elements.ts
  6. 4
      public/app/plugins/datasource/prometheus/querybuilder/components/MetricSelect.tsx
  7. 6
      public/sass/base/_type.scss

@ -36,6 +36,10 @@ export interface ThemeComponents {
background: string;
padding: number;
};
textHighlight: {
background: string;
text: string;
};
sidemenu: {
width: number;
};
@ -91,6 +95,10 @@ export function createComponents(colors: ThemeColors, shadows: ThemeShadows): Th
menuTabs: {
height: 41,
},
textHighlight: {
text: colors.warning.contrastText,
background: colors.warning.main,
},
horizontalDrawer: {
defaultHeight: 400,
},

@ -139,8 +139,8 @@ const getLabelStyles = (theme: GrafanaTheme2) => ({
`,
matchHighLight: css`
background: inherit;
color: ${theme.colors.primary.text};
background-color: ${theme.colors.primary.transparent};
color: ${theme.components.textHighlight.text};
background-color: ${theme.components.textHighlight.background};
`,
hidden: css`
opacity: 0.6;

@ -120,8 +120,6 @@ class UnThemedLogRowMessage extends PureComponent<Props> {
const style = getLogRowStyles(theme, row.logLevel);
const { hasAnsi, raw } = row;
const restructuredEntry = restructureLog(raw, prettifyLogMessage);
const highlightClassName = cx([style.logsRowMatchHighLight]);
const styles = getStyles(theme);
return (
@ -145,7 +143,7 @@ class UnThemedLogRowMessage extends PureComponent<Props> {
/>
)}
<span className={cx(styles.positionRelative, { [styles.rowWithContext]: contextIsOpen })}>
{renderLogMessage(hasAnsi, restructuredEntry, row.searchWords, highlightClassName)}
{renderLogMessage(hasAnsi, restructuredEntry, row.searchWords, style.logsRowMatchHighLight)}
</span>
{showContextToggle?.(row) && (
<span

@ -37,13 +37,8 @@ export const getLogRowStyles = stylesFactory((theme: GrafanaTheme2, logLevel?: L
label: logs-row__match-highlight;
background: inherit;
padding: inherit;
color: ${theme.colors.warning.main};
background-color: rgba(${theme.colors.warning.main}, 0.1);
`,
logsRowMatchHighLightPreview: css`
label: logs-row__match-highlight--preview;
background-color: rgba(${theme.colors.warning.main}, 0.2);
border-bottom-style: dotted;
color: ${theme.components.textHighlight.text}
background-color: ${theme.components.textHighlight};
`,
logsRowsTable: css`
label: logs-rows;

@ -155,6 +155,12 @@ export function getElementStyles(theme: GrafanaTheme2) {
.text-center {
text-align: center;
}
.highlight-search-match {
background: ${theme.components.textHighlight.background};
color: ${theme.components.textHighlight.text};
padding: 0;
}
`;
}

@ -95,7 +95,7 @@ const getStyles = (theme: GrafanaTheme2) => ({
label: select__match-highlight;
background: inherit;
padding: inherit;
color: ${theme.colors.warning.main};
background-color: rgba(${theme.colors.warning.main}, 0.1);
color: ${theme.colors.warning.contrastText};
background-color: ${theme.colors.warning.main};
`,
});

@ -260,12 +260,6 @@ a.external-link {
white-space: nowrap;
}
.highlight-search-match {
background: transparent;
color: $yellow;
padding: 0;
}
th {
font-weight: $font-weight-semi-bold;
}

Loading…
Cancel
Save