Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud Security preparation for Kibana Borealis theme #204653

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import { euiThemeVars } from '@kbn/ui-theme';

export const statusColors = {
passed: euiThemeVars.euiColorSuccess,
failed: euiThemeVars.euiColorVis9,
passed: '#00bfb3',
failed: '#e7664c',
unknown: euiThemeVars.euiColorLightShade,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,47 @@
* 2.0.
*/

import { euiThemeVars } from '@kbn/ui-theme';
import type { VulnSeverity } from '@kbn/cloud-security-posture-common';
import { VULNERABILITIES_SEVERITY } from '@kbn/cloud-security-posture-common';

const VULNERABILITY_SEVERITY_COLOR_PALETTE = {
critical: '#BD271E',
high: '#FF7E62',
medium: '#F1D86F',
low: '#54B399',
unknown: '#aaa',
};

const VULNERABILITY_SCORE_COLOR_PALETTE = {
critical: '#BD271E',
high: '#DA8B45',
medium: '#D6BF57',
low: '#54B399',
};

export const getCvsScoreColor = (score: number): string | undefined => {
if (score <= 4) {
return euiThemeVars.euiColorVis0; // low severity
return VULNERABILITY_SCORE_COLOR_PALETTE.low;
} else if (score >= 4 && score <= 7) {
return euiThemeVars.euiColorVis7; // medium severity
return VULNERABILITY_SCORE_COLOR_PALETTE.medium;
} else if (score >= 7 && score <= 9) {
return euiThemeVars.euiColorVis9; // high severity
return VULNERABILITY_SCORE_COLOR_PALETTE.high;
} else if (score >= 9) {
return euiThemeVars.euiColorDanger; // critical severity
return VULNERABILITY_SCORE_COLOR_PALETTE.critical;
}
};

export const getSeverityStatusColor = (severity: VulnSeverity): string => {
switch (severity) {
case VULNERABILITIES_SEVERITY.LOW:
return euiThemeVars.euiColorVis0;
return VULNERABILITY_SEVERITY_COLOR_PALETTE.low;
case VULNERABILITIES_SEVERITY.MEDIUM:
return euiThemeVars.euiColorVis5_behindText;
return VULNERABILITY_SEVERITY_COLOR_PALETTE.medium;
case VULNERABILITIES_SEVERITY.HIGH:
return euiThemeVars.euiColorVis9_behindText;
return VULNERABILITY_SEVERITY_COLOR_PALETTE.high;
case VULNERABILITIES_SEVERITY.CRITICAL:
return euiThemeVars.euiColorDanger;
return VULNERABILITY_SEVERITY_COLOR_PALETTE.critical;
default:
return '#aaa';
return VULNERABILITY_SEVERITY_COLOR_PALETTE.unknown;
}
};