The WebHelp Responsive output supports dark mode, allowing users to switch between light and dark themes based on their preference or their browser's settings. The dark mode feature enhances readability and reduces eye strain in low-light environments.
After enabling dark mode, the output will use the theme selected in the browser's settings and a "Switch theme" button will be displayed in the header.
:root {
--wh-body-bg: #fff;
--wh-body-color: #000;
--wh-border-color: #000;
--wh-link-color: #0d6efd;
--wh-search-bg: #ddd;
--wh-letters-bg: #f2f2f2;
--wh-main-page-toc-bg: #eeeeee;
--wh-toc-shortdesc-color: #808080;
--wh-top-menu-bg: #e6e6e6;
--wh-oxy-change-bg: #ffff00;
}:root {
--wh-search-bg: #ECF2F9;
--wh-main-page-toc-bg: #F2F8FF;
--wh-toc-shortdesc-color: #0D1A2B;
}@data-wh-theme="dark"), for
example::root[data-wh-theme="dark"] {
color-scheme: dark;
--wh-body-bg: #212529;
--wh-body-color: #e3e3e3;
--wh-border-color: #e3e3e3;
--wh-link-color: #5185cb;
--wh-search-bg: #2b3035;
--wh-letters-bg: #2a2a2a;
--wh-main-page-toc-bg: #22303c;
--wh-toc-shortdesc-color: #d5d5d5;
--wh-top-menu-bg: var(--wh-search-bg);
--wh-oxy-change-bg: #b59f00;
}:root {
/* Override default colors */
--wh-search-bg: #ECF2F9;
--wh-main-page-toc-bg: #F2F8FF;
--wh-toc-shortdesc-color: #0D1A2B;
/* New color variables */
--wh-tile-bg: #ECF2F9;
--wh-breadcrumb-bg: #ECF2F9;
--wh-search-input-bg: #2771bb;
/* Image variable */
--wh-search-image-small: url("resources/images/bgr_right_small.png");
}
:root[data-wh-theme="dark"] {
/* Add default colors */
color-scheme: dark;
--wh-body-bg: #212529;
--wh-body-color: #e3e3e3;
--wh-border-color: #e3e3e3;
--wh-link-color: #5185cb;
--wh-search-bg: #2b3035;
--wh-letters-bg: #2a2a2a;
--wh-main-page-toc-bg: #22303c;
--wh-toc-shortdesc-color: #d5d5d5;
--wh-top-menu-bg: var(--wh-search-bg);
--wh-oxy-change-bg: #b59f00;
/* New color variables */
--wh-tile-bg: #2B3035;
--wh-breadcrumb-bg: #2B3035;
--wh-search-input-bg: #184573;
/* Image variable */
--wh-search-image-small: url("resources/images/bgr_right_small_dark.png");
}<publishing-template>
...
<webhelp>
...
<resources>
<css file="custom-color.css"/>.wh_tile {
background-color: var(--wh-tile-bg);
}
.wh_tools{
background-color: var(--wh-breadcrumb-bg);
}
.wh_search_input{
background: var(--wh-search-image-small) right no-repeat var(--wh-search-input-bg);
}body { background-color: var(--wh-body-bg); } in
wh-common.css) will automatically use the new colors.<publishing-template>
...
<webhelp>
...
<resources>
<css file="custom-color.css"/>
<css file="custom.css"/>
</resources>
...
<parameters>
...
<parameter name="webhelp.enable.dark.mode" value="yes"/>
</parameters>:root {
--wh-body-bg: #fff;
--wh-body-color: #000;
...
}
:root[data-wh-theme="dark"] {
color-scheme: dark;
--wh-body-bg: #293136;
--wh-body-color: #e3e3e3;
...
}<publishing-template>
...
<webhelp>
<resources>
<css file="ashes-color.css"/>
<css file="ashes.css"/>
...
</resources>body {
font-family: "PT Sans", sans-serif;
background-color: var(--wh-body-bg);
}