Skip to content

Commit

Permalink
add dark mode support for html
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredsburrows committed Apr 8, 2024
1 parent 3d6676d commit bece6f9
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,17 @@ class HtmlReport(private val projects: List<Model>) : Report {
const val DOCTYPE = "<!DOCTYPE html>"
const val META = "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">"
const val CSS_STYLE =
"body { font-family: sans-serif } " +
// Default light theme styles
"body { font-family: sans-serif; background-color: #ffffff; color: #000000; } " +
"a { color: #0000EE; } " +
"pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; " +
"word-break: break-word; display: inline-block }"
"word-break: break-word; display: inline-block; } " +

// Dark theme styles
"@media (prefers-color-scheme: dark) { " +
"body { background-color: #121212; color: #E0E0E0; } " +
"a { color: #BB86FC; } " +
"pre { background-color: #333333; color: #E0E0E0; } }"
const val OPEN_SOURCE_LIBRARIES = "Open source licenses"
const val NO_LIBRARIES = "None"
const val NO_LICENSE = "No license found"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ final class LicensePluginAndroidSpec extends Specification {
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>body { font-family: sans-serif } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block }</style>
<style>body { font-family: sans-serif; background-color: #ffffff; color: #000000; } a { color: #0000EE; } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block; } @media (prefers-color-scheme: dark) { body { background-color: #121212; color: #E0E0E0; } a { color: #BB86FC; } pre { background-color: #333333; color: #E0E0E0; } }</style>
<title>Open source licenses</title>
</head>
<body>
Expand Down Expand Up @@ -157,7 +157,7 @@ final class LicensePluginAndroidSpec extends Specification {
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>body { font-family: sans-serif } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block }</style>
<style>body { font-family: sans-serif; background-color: #ffffff; color: #000000; } a { color: #0000EE; } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block; } @media (prefers-color-scheme: dark) { body { background-color: #121212; color: #E0E0E0; } a { color: #BB86FC; } pre { background-color: #333333; color: #E0E0E0; } }</style>
<title>Open source licenses</title>
</head>
<body>
Expand Down Expand Up @@ -369,7 +369,7 @@ final class LicensePluginAndroidSpec extends Specification {
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>body { font-family: sans-serif } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block }</style>
<style>body { font-family: sans-serif; background-color: #ffffff; color: #000000; } a { color: #0000EE; } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block; } @media (prefers-color-scheme: dark) { body { background-color: #121212; color: #E0E0E0; } a { color: #BB86FC; } pre { background-color: #333333; color: #E0E0E0; } }</style>
<title>Open source licenses</title>
</head>
<body>
Expand Down Expand Up @@ -519,7 +519,7 @@ final class LicensePluginAndroidSpec extends Specification {
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>body { font-family: sans-serif } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block }</style>
<style>body { font-family: sans-serif; background-color: #ffffff; color: #000000; } a { color: #0000EE; } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block; } @media (prefers-color-scheme: dark) { body { background-color: #121212; color: #E0E0E0; } a { color: #BB86FC; } pre { background-color: #333333; color: #E0E0E0; } }</style>
<title>Open source licenses</title>
</head>
<body>
Expand Down Expand Up @@ -748,7 +748,7 @@ final class LicensePluginAndroidSpec extends Specification {
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>body { font-family: sans-serif } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block }</style>
<style>body { font-family: sans-serif; background-color: #ffffff; color: #000000; } a { color: #0000EE; } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block; } @media (prefers-color-scheme: dark) { body { background-color: #121212; color: #E0E0E0; } a { color: #BB86FC; } pre { background-color: #333333; color: #E0E0E0; } }</style>
<title>Open source licenses</title>
</head>
<body>
Expand Down Expand Up @@ -894,7 +894,7 @@ final class LicensePluginAndroidSpec extends Specification {
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>body { font-family: sans-serif } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block }</style>
<style>body { font-family: sans-serif; background-color: #ffffff; color: #000000; } a { color: #0000EE; } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block; } @media (prefers-color-scheme: dark) { body { background-color: #121212; color: #E0E0E0; } a { color: #BB86FC; } pre { background-color: #333333; color: #E0E0E0; } }</style>
<title>Open source licenses</title>
</head>
<body>
Expand Down Expand Up @@ -1011,7 +1011,7 @@ final class LicensePluginAndroidSpec extends Specification {
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>body { font-family: sans-serif } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block }</style>
<style>body { font-family: sans-serif; background-color: #ffffff; color: #000000; } a { color: #0000EE; } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block; } @media (prefers-color-scheme: dark) { body { background-color: #121212; color: #E0E0E0; } a { color: #BB86FC; } pre { background-color: #333333; color: #E0E0E0; } }</style>
<title>Open source licenses</title>
</head>
<body>
Expand Down Expand Up @@ -1166,7 +1166,7 @@ final class LicensePluginAndroidSpec extends Specification {
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>body { font-family: sans-serif } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block }</style>
<style>body { font-family: sans-serif; background-color: #ffffff; color: #000000; } a { color: #0000EE; } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block; } @media (prefers-color-scheme: dark) { body { background-color: #121212; color: #E0E0E0; } a { color: #BB86FC; } pre { background-color: #333333; color: #E0E0E0; } }</style>
<title>Open source licenses</title>
</head>
<body>
Expand Down Expand Up @@ -1667,7 +1667,7 @@ final class LicensePluginAndroidSpec extends Specification {
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>body { font-family: sans-serif } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block }</style>
<style>body { font-family: sans-serif; background-color: #ffffff; color: #000000; } a { color: #0000EE; } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block; } @media (prefers-color-scheme: dark) { body { background-color: #121212; color: #E0E0E0; } a { color: #BB86FC; } pre { background-color: #333333; color: #E0E0E0; } }</style>
<title>Open source licenses</title>
</head>
<body>
Expand Down Expand Up @@ -1769,7 +1769,7 @@ final class LicensePluginAndroidSpec extends Specification {
<!DOCTYPE html>
<html lang="en">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>body { font-family: sans-serif } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block }</style>
<style>body { font-family: sans-serif; background-color: #ffffff; color: #000000; } a { color: #0000EE; } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block; } @media (prefers-color-scheme: dark) { body { background-color: #121212; color: #E0E0E0; } a { color: #BB86FC; } pre { background-color: #333333; color: #E0E0E0; } }</style>
<title>Open source licenses</title>
</head>
<body>
Expand Down Expand Up @@ -1863,7 +1863,7 @@ final class LicensePluginAndroidSpec extends Specification {
<!DOCTYPE html>
<html lang="en">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>body { font-family: sans-serif } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block }</style>
<style>body { font-family: sans-serif; background-color: #ffffff; color: #000000; } a { color: #0000EE; } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block; } @media (prefers-color-scheme: dark) { body { background-color: #121212; color: #E0E0E0; } a { color: #BB86FC; } pre { background-color: #333333; color: #E0E0E0; } }</style>
<title>Open source licenses</title>
</head>
<body>
Expand Down Expand Up @@ -1929,7 +1929,7 @@ final class LicensePluginAndroidSpec extends Specification {
<!DOCTYPE html>
<html lang="en">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>body { font-family: sans-serif } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block }</style>
<style>body { font-family: sans-serif; background-color: #ffffff; color: #000000; } a { color: #0000EE; } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block; } @media (prefers-color-scheme: dark) { body { background-color: #121212; color: #E0E0E0; } a { color: #BB86FC; } pre { background-color: #333333; color: #E0E0E0; } }</style>
<title>Open source licenses</title>
</head>
<body>
Expand Down Expand Up @@ -2023,7 +2023,7 @@ final class LicensePluginAndroidSpec extends Specification {
<!DOCTYPE html>
<html lang="en">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>body { font-family: sans-serif } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block }</style>
<style>body { font-family: sans-serif; background-color: #ffffff; color: #000000; } a { color: #0000EE; } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block; } @media (prefers-color-scheme: dark) { body { background-color: #121212; color: #E0E0E0; } a { color: #BB86FC; } pre { background-color: #333333; color: #E0E0E0; } }</style>
<title>Open source licenses</title>
</head>
<body>
Expand Down Expand Up @@ -2090,7 +2090,7 @@ final class LicensePluginAndroidSpec extends Specification {
<!DOCTYPE html>
<html lang="en">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>body { font-family: sans-serif } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block }</style>
<style>body { font-family: sans-serif; background-color: #ffffff; color: #000000; } a { color: #0000EE; } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block; } @media (prefers-color-scheme: dark) { body { background-color: #121212; color: #E0E0E0; } a { color: #BB86FC; } pre { background-color: #333333; color: #E0E0E0; } }</style>
<title>Open source licenses</title>
</head>
<body>
Expand Down Expand Up @@ -2186,7 +2186,7 @@ final class LicensePluginAndroidSpec extends Specification {
<!DOCTYPE html>
<html lang="en">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>body { font-family: sans-serif } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block }</style>
<style>body { font-family: sans-serif; background-color: #ffffff; color: #000000; } a { color: #0000EE; } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block; } @media (prefers-color-scheme: dark) { body { background-color: #121212; color: #E0E0E0; } a { color: #BB86FC; } pre { background-color: #333333; color: #E0E0E0; } }</style>
<title>Open source licenses</title>
</head>
<body>
Expand Down Expand Up @@ -2280,7 +2280,7 @@ final class LicensePluginAndroidSpec extends Specification {
<!DOCTYPE html>
<html lang="en">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>body { font-family: sans-serif } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block }</style>
<style>body { font-family: sans-serif; background-color: #ffffff; color: #000000; } a { color: #0000EE; } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block; } @media (prefers-color-scheme: dark) { body { background-color: #121212; color: #E0E0E0; } a { color: #BB86FC; } pre { background-color: #333333; color: #E0E0E0; } }</style>
<title>Open source licenses</title>
</head>
<body>
Expand Down
Loading

0 comments on commit bece6f9

Please sign in to comment.