This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-fluido-skin.git
commit 622572892b5998f20272ecc4be6ba27b7b5fa4a7 Author: Philemon Hilscher <[email protected]> AuthorDate: Thu Apr 2 15:48:25 2026 +0200 Change dark theme to be enableable in the site descriptor Signed-off-by: Philemon Hilscher <[email protected]> --- pom.xml | 1 + src/main/resources/META-INF/maven/site.vm | 3 + src/main/resources/css/dark-theme.css | 107 ++++++++++++++++++++++++++++++ src/main/resources/css/maven-theme.css | 89 ------------------------- src/site/markdown/index.md.vm | 17 +++++ src/site/site.xml | 1 + 6 files changed, 129 insertions(+), 89 deletions(-) diff --git a/pom.xml b/pom.xml index 8dd405b..10f156f 100644 --- a/pom.xml +++ b/pom.xml @@ -140,6 +140,7 @@ under the License. <directory>${basedir}/src/main/resources</directory> <includes> <include>css/print.css</include> + <include>css/dark-theme.css</include> </includes> </resource> diff --git a/src/main/resources/META-INF/maven/site.vm b/src/main/resources/META-INF/maven/site.vm index 310aba7..c884582 100644 --- a/src/main/resources/META-INF/maven/site.vm +++ b/src/main/resources/META-INF/maven/site.vm @@ -52,6 +52,9 @@ <link rel="stylesheet" href="$relativePath/css/[email protected][email protected]" /> <link rel="stylesheet" href="$relativePath/css/site.css" /> <link rel="stylesheet" href="$relativePath/css/print.css" media="print" /> +#if( $convert.toBoolean( $site.getCustomValue( 'fluidoSkin.darkThemeEnabled', 'false' ) ) ) + <link rel="stylesheet" href="$relativePath/css/dark-theme.css" /> +#end #**##prjProfile() <script src="$relativePath/js/[email protected][email protected]"></script> #**##if( $site.body.head ) diff --git a/src/main/resources/css/dark-theme.css b/src/main/resources/css/dark-theme.css new file mode 100644 index 0000000..4e5ea44 --- /dev/null +++ b/src/main/resources/css/dark-theme.css @@ -0,0 +1,107 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +@media (prefers-color-scheme: dark) { + :root { + color-scheme: dark; + --area-background-color: #222; + --stripe-color: #333; + --border-color: #666; + --pre-color: #c1c1c1; + --text-color: #fff; + --link-color: #0088cc; + --code-color: #ff7b72; + --tag-color: #7cacf8; + --atn-color: #bf67ff; + --atv-color: #6dd58c; + --pun-color: #facc15; + } + .nav>li>a:hover, .nav>li>a:focus { + background-color: var(--stripe-color); + color: var(--text-color); + } + body { + color: var(--text-color); + background-color: unset; + } + .breadcrumb, .well { + background-color: var(--area-background-color); + color: var( --text-color); + } + .table-striped>tbody>tr:nth-child(even)>td, + .table-striped>tbody>tr:nth-child(even)>th, + li.L0, li.L2, li.L4, li.L6, li.L8, .zebra-striped { + background-color: var(--area-background-color); + } + .table-striped>tbody>tr:nth-child(odd)>td, + .table-striped>tbody>tr:nth-child(odd)>th, + li.L1, li.L3, li.L5, li.L7, li.L9 { + background-color: var(--stripe-color); + } + .table th, .table td { + border-top-color: var(--border-color); + } + pre.prettyprint, .well, .table-bordered, .table-bordered th, .table-bordered td { + border-color: var(--border-color); + } + pre { + background-color: var(--area-background-color); + } + .linenums > li, pre { + color: var(--pre-color); + } + li { + color: unset; + } + code, tt { + color: var(--code-color); + background-color: unset; + border-color: var(--border-color); + } + .tag { + color: var(--tag-color); + } + .atn, .typ { + color: var(--atn-color); + } + .atv, .str, .lit { + color: var(--atv-color); + } + .pln { + color: var(--text-color); + } + .com { + color: var(--code-color); + } + .pun, .opn, .clo { + color: var(--pun-color); + } + hr { + border-bottom-color: var(--border-color); + border-top-color: var(--border-color); + } + input[type="text"] { + background-color: var(--area-background-color); + border-color: var(--border-color); + color: var(--text-color); + } + [class^="icon-"], [class*=" icon-"] { + background-image: url(../img/glyphicons-halflings-white.png); + } +} diff --git a/src/main/resources/css/maven-theme.css b/src/main/resources/css/maven-theme.css index 2b7b816..d9a9c15 100644 --- a/src/main/resources/css/maven-theme.css +++ b/src/main/resources/css/maven-theme.css @@ -124,92 +124,3 @@ a > code { .nav-header, .nav-list>li>a, .breadcrumb>li { text-shadow: none; } - -@media (prefers-color-scheme: dark) { - :root { - color-scheme: dark; - --area-background-color: #222; - --stripe-color: #333; - --border-color: #666; - --pre-color: #c1c1c1; - --text-color: #fff; - --link-color: #0088cc; - --code-color: #ff7b72; - --tag-color: #7cacf8; - --atn-color: #bf67ff; - --atv-color: #6dd58c; - --pun-color: #facc15; - } - .nav>li>a:hover, .nav>li>a:focus { - background-color: var(--stripe-color); - color: var(--text-color); - } - body { - color: var(--text-color); - background-color: unset; - } - .breadcrumb, .well { - background-color: var(--area-background-color); - color: var( --text-color); - } - .table-striped>tbody>tr:nth-child(even)>td, - .table-striped>tbody>tr:nth-child(even)>th, - li.L0, li.L2, li.L4, li.L6, li.L8, .zebra-striped { - background-color: var(--area-background-color) !important; - } - .table-striped>tbody>tr:nth-child(odd)>td, - .table-striped>tbody>tr:nth-child(odd)>th, - li.L1, li.L3, li.L5, li.L7, li.L9 { - background-color: var(--stripe-color) !important; - } - .table th, .table td { - border-top-color: var(--border-color); - } - pre.prettyprint, .well, .table-bordered, .table-bordered th, .table-bordered td { - border-color: var(--border-color); - } - pre { - background-color: var(--area-background-color); - } - .linenums > li, pre { - color: var(--pre-color); - } - li { - color: unset; - } - code, tt { - color: var(--code-color); - background-color: unset; - border-color: var(--border-color); - } - .tag { - color: var(--tag-color) !important; - } - .atn, .typ { - color: var(--atn-color) !important; - } - .atv, .str, .lit { - color: var(--atv-color) !important; - } - .pln { - color: var(--text-color) !important; - } - .com { - color: var(--code-color) !important; - } - .pun, .opn, .clo { - color: var(--pun-color) !important; - } - hr { - border-bottom-color: var(--border-color); - border-top-color: var(--border-color); - } - input[type="text"] { - background-color: var(--area-background-color); - border-color: var(--border-color); - color: var(--text-color); - } - [class^="icon-"], [class*=" icon-"] { - background-image: url(../img/glyphicons-halflings-white.png); - } -} diff --git a/src/site/markdown/index.md.vm b/src/site/markdown/index.md.vm index d8be730..a73303e 100644 --- a/src/site/markdown/index.md.vm +++ b/src/site/markdown/index.md.vm @@ -533,6 +533,23 @@ Since version **1\.3\.1**, you can configure the breadcrumb divider (default is </site> ``` +${esc.h}${esc.h}${esc.h} <a id="Dark_Theme"></a>Dark Theme + +Since version **2\.2\.0**, you can enable a dark theme, which activates based on the browser preferences: + +```xml +<site xmlns="http://maven.apache.org/SITE/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SITE/2.0.0 https://maven.apache.org/xsd/site-2.0.0.xsd"> + [...] + <custom> + <fluidoSkin> + <darkThemeEnabled>true</darkThemeEnabled> + </fluidoSkin> + </custom> + [...] +</site> +``` + # Acknowledgment ${project.name} contains/redistributes [Glyphicons Halflings](https://glyphicons.com) as part of Bootstrap by Twitter, released under [Creative Commons Attribution 3\.0 Unported (CC BY 3\.0)](https://creativecommons.org/licenses/by/3.0/deed.en). diff --git a/src/site/site.xml b/src/site/site.xml index a563ce9..c0dbce2 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -32,6 +32,7 @@ under the License. <custom> <fluidoSkin> + <darkThemeEnabled>true</darkThemeEnabled> <gitHub> <projectId>apache/${project.artifactId}</projectId> <ribbonOrientation>right</ribbonOrientation>
