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

Reports: Add dark mode #4479

Closed
wants to merge 2 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Gatling is developed in Scala and built upon :

* [Netty](https://netty.io) for non blocking HTTP
* [Akka](https://akka.io) for virtual users orchestration
...

## Questions, help?

Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
--gatling-enterprise-light-color: #c4c4ed;
--gatling-gray-medium-color: #bbb;
--gatling-hover-color: #e6e6e6;
--gatling-hover-background-color: #e6e6e6;
--gatling-light-color: #ffffff;
--gatling-orange-color: #f78557;
--gatling-success-color: #68b65c;
Expand All @@ -49,6 +50,26 @@
--gatling-media-desktop-large: 1920px;
}

html[data-theme="dark"] {
--gatling-background-color: #212529;
--gatling-background-light-color: #30363b;
--gatling-border-color: #555555;
--gatling-blue-color: #1188ff;
--gatling-dark-blue-color: #17223B;
--gatling-danger-color: #d9534f;
--gatling-danger-light-color: #c9302c;
--gatling-enterprise-color: #6161d6;
--gatling-enterprise-light-color: #343479;
--gatling-gray-medium-color: #999;
--gatling-hover-color: #e6e6e6;
--gatling-hover-background-color: #2c2c2c;
--gatling-light-color: #292929;
--gatling-orange-color: #f78557;
--gatling-success-color: #5cb85c;
--gatling-text-color: #dee2e6;
--gatling-total-color: #ffa900;
}

* {
min-height: 0;
min-width: 0;
Expand Down Expand Up @@ -89,6 +110,42 @@ body {
padding: 0 var(--gatling-spacing-layout);
}

.head .spacer {
flex-grow: 1;
}

.head .theme-toggle {
margin-left: 20px;
background: none;
color: var(--gatling-text-color);
border: none;
}

.head .theme-toggle:hover {
color: var(--gatling-hover-color);
cursor: pointer;
}

body .toggle-dark, body .toggle-light {
display: block;
}

[data-theme="dark"] body .toggle-dark {
display: none;
}

[data-theme="light"] body .toggle-light {
display: none;
}

[data-theme="dark"] body .logo-enterprise-light {
display: none;
}

[data-theme="light"] body .logo-enterprise-dark {
display: none;
}

.gatling-open-source {
display: flex;
align-items: center;
Expand Down Expand Up @@ -123,6 +180,14 @@ body {
height: 100%;
}

[data-theme="dark"] .gatling-logo-light {
display: none;
}

[data-theme="light"] .gatling-logo-dark {
display: none;
}

.container {
display: flex;
align-items: stretch;
Expand Down Expand Up @@ -603,6 +668,37 @@ h1 span {
padding: 2px var(--gatling-spacing);
}

html[data-theme="dark"] .chart_title {
color: var(--gatling-text-color);
font-weight: var(--gatling-font-weight-bold);
font-size: var(--gatling-font-size-heading);
padding: 2px var(--gatling-spacing);
}

html[data-theme="dark"] .highcharts-background {
fill: var(--gatling-background-light-color);
}

html[data-theme="dark"] .highcharts-button-normal rect {
fill: var(--gatling-background-color) !important;
}

html[data-theme="dark"] .highcharts-button-disabled rect {
fill: var(--gatling-background-light-color) !important;
}

html[data-theme="dark"] .highcharts-button-pressed rect {
fill: var(--gatling-orange-color) !important;
}

html[data-theme="dark"] .highcharts-axis text,
html[data-theme="dark"] .highcharts-axis-labels text,
html[data-theme="dark"] .highcharts-button text,
html[data-theme="dark"] .highcharts-legend-item text,
html[data-theme="dark"] .highcharts-range-selector-buttons text {
fill: var(--gatling-text-color) !important;
}

.statistics {
display: flex;
flex-direction: column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,36 @@ ${jsFiles.map(jsFile => s"""<script src="js/$jsFile"></script>""").mkString(Eol)
<title>Gatling Stats - $title</title>
</head>
<body>
<script>
const storedTheme = localStorage.getItem('theme') || (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
if (storedTheme) document.documentElement.setAttribute('data-theme', storedTheme)

function toggleTheme() {
const currentTheme = document.documentElement.getAttribute("data-theme");
const targetTheme = currentTheme === "light" ? "dark" : "light";

document.documentElement.setAttribute('data-theme', targetTheme)
localStorage.setItem('theme', targetTheme);
};
</script>
<div class="app-container">
<div class="frise"></div>
<div class="head">
<div class="gatling-open-source">
<a class="gatling-logo" href="https://gatling.io" target="blank_" title="Gatling Home Page"><img alt="Gatling" src="style/logo.svg"/></a>
<a class="gatling-logo gatling-logo-light" href="https://gatling.io" target="blank_" title="Gatling Home Page"><img alt="Gatling" src="style/logo.svg"/></a>
<a class="gatling-logo gatling-logo-dark" href="https://gatling.io" target="blank_" title="Gatling Home Page"><img alt="Gatling" src="style/logo.svg"/></a>
<a class="gatling-documentation" href="https://gatling.io/docs/" target="_blank">Documentation</a>
</div>
<a class="enterprise" href="https://gatling.io/enterprise/next-step/" target="_blank">Try <img alt="Gatling Enterprise" src="style/logo-enterprise.svg"/></a></div>
<div class="nav spacer"></div>
<a class="enterprise" href="https://gatling.io/enterprise/next-step/" target="_blank">Try
<img class="logo-enterprise-light" alt="Gatling Enterprise" src="style/logo-enterprise-light.svg"/>
<img class="logo-enterprise-dark" alt="Gatling Enterprise" src="style/logo-enterprise-dark.svg"/>
</a>
<button id="theme-toggle" class="theme-toggle" type="button" onclick="toggleTheme()" aria-label="Toggle user interface mode">
<span class="toggle-dark"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-moon"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg></span>
<span class="toggle-light"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-sun"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line></svg></span>
</button>
</div>
<div class="container details">
<div class="nav">
<ul></ul>
Expand Down