Hinode logo
  • About 
  • Docs 
  • Components 
  • Guides 
  • Releases 
  •  
Docs
  • Getting Started
    • Introduction
    • Commands
    • Hosting and Deployment
    • Upgrading
    • Private Modules and Packages
    • Contribute
    • Troubleshooting
  • Content
    • Content Management
    • Content Organization
    • Typography
    • Links and Cross-References
    • Images and Figures
    • Tables
    • Icons
  • Configuration
    • Layout
    • Colors
    • Color Modes
    • Fonts
    • Languages
    • Navigation
    • Documentation
    • Analytics
    • Modules
    • Cookie Consent
    • Digital Asset Managers
  • Components
    • Abbr
    • Accordion
    • Alert
    • Animation
    • Args
    • Badge
    • Breadcrumb
    • Button
    • Button Group
    • Card
    • Card Group
    • Carousel
    • Collapse
    • Command Prompt
    • Docs
    • Example
    • File
    • Icon
    • Image
    • Ins
    • Kbd
    • Link
    • Map
    • Mark
    • Navbar
    • Navs and Tabs
    • Persona
    • Release
    • Spinner
    • Sub
    • Sup
    • Table
    • Timeline
    • Toast
    • Tooltip
    • Video
  • Advanced Settings
    • Overview
    • Styles
    • Scripts
    • Icons
    • Partial Development
    • Module Development
    • Server Headers
    • Server-Side Redirection
  • About
    • Credits
    • License
  • Getting Started
    • Introduction
    • Commands
    • Hosting and Deployment
    • Upgrading
    • Private Modules and Packages
    • Contribute
    • Troubleshooting
  • Content
    • Content Management
    • Content Organization
    • Typography
    • Links and Cross-References
    • Images and Figures
    • Tables
    • Icons
  • Configuration
    • Layout
    • Colors
    • Color Modes
    • Fonts
    • Languages
    • Navigation
    • Documentation
    • Analytics
    • Modules
    • Cookie Consent
    • Digital Asset Managers
  • Components
    • Abbr
    • Accordion
    • Alert
    • Animation
    • Args
    • Badge
    • Breadcrumb
    • Button
    • Button Group
    • Card
    • Card Group
    • Carousel
    • Collapse
    • Command Prompt
    • Docs
    • Example
    • File
    • Icon
    • Image
    • Ins
    • Kbd
    • Link
    • Map
    • Mark
    • Navbar
    • Navs and Tabs
    • Persona
    • Release
    • Spinner
    • Sub
    • Sup
    • Table
    • Timeline
    • Toast
    • Tooltip
    • Video
  • Advanced Settings
    • Overview
    • Styles
    • Scripts
    • Icons
    • Partial Development
    • Module Development
    • Server Headers
    • Server-Side Redirection
  • About
    • Credits
    • License

Color Modes

Share via
Hinode
Link copied to clipboard

Add light mode and dark mode support to your website.

On this page
Color Modes   Display Property   Accessibility   Sass  

Color Modes  

Added in v0.9.0   

Hinode supports color modes, or themes, as introduced by Bootstrap v5.3.0. By default, the site is rendered in light mode. If dark mode is enabled, a toggler is added to the main navigation. The toggler enables switching between modes, or can be set to auto. In the latter mode, the site uses the mode as preferred by the device. Hinode uses data attributes to toggle the site’s color mode. Visit the Bootstrap Documentation  for more information. You can enable of disable the support for dark mode in the Extended Layout Configuration.

Display Property  

Hinode defines two classes to simplify the development of color-mode aware websites. Simply add .d-none-dark as class attribute to block the display of an element in dark mode. Vice versa, use .d-none-light to block the content from rendering in light mode. The following example illustrates this behavior. Toggle the color mode of the current website to test the behavior.

I’m visible in light mode only

I’m visible in dark mode only

markdown
I'm visible in {{< mark >}}light mode{{< /mark >}} only
{.d-none-dark}

I'm visible in {{< mark >}}dark mode{{< /mark >}} only
{.d-none-light}

Accessibility  

Added in v0.18.0   

Contrast is an important aspect of your site accessibility. The WCAG Color Contrast Guidelines  recommends a minimum contrast ratio of 4.5:1 for most content elements. Defining a color scheme that has sufficient contrast in all color modes can be challenging. Hinode supports two attributes to enhance the contrast ratio of the primary color in dark mode.

The argument darkModeTint lightens the primary color with a given percentage, while darkModeShade darkens the primary background color. You can adjust these settings in the style section of the site parameters.

Setting Default Description
darkModeShade “20%” Darkens the primary background color in dark mode with a given percentage, defaults to 20%.
darkModeTint “40%” Lightens the primary color in dark mode with a given percentage, defaults to 40%.
Setting Default
darkModeShade “20%”
Darkens the primary background color in dark mode with a given percentage, defaults to 20%.
darkModeTint “40%”
Lightens the primary color in dark mode with a given percentage, defaults to 40%.

Sass  

The helper color-mode is available to simplify the development of color-mode aware stylesheets. The following example defines a default background gradient for the colors white and the primary Theme Color. If $enable-dark-mode is enabled (see Extended Layout Configuration), the helper color-mode inserts an alternative gradient that is applicable to dark mode.

.gradient-featured {
    background: $white;
    background: linear-gradient(135deg, $white 0%, tint-color($primary, 80%) 100%);
}

@if $enable-dark-mode {
    @include color-mode(dark) {
        .gradient-featured {
            background: $gray-900;
            background: linear-gradient(135deg, $gray-900 0%, shade-color($primary, 60%) 100%);
        }
    }
}

The final CSS generated by Hinode looks like this:

.gradient-featured {
    background: #fff;
    background: linear-gradient(135deg, #fff 0%, #f6d7cc 100%);
}

[data-bs-theme="dark"] .gradient-featured {
    background: #212529;
    background: linear-gradient(135deg, #212529 0%, #551700 100%);
}
• Remove deprecated shortcode 'comment' (291614e)
On this page:
Color Modes   Display Property   Accessibility   Sass  
Color modes
Color modes
Hinode is a clean documentation and blog theme for your Hugo site based on Bootstrap 5.
Code licensed MIT, docs CC BY-NC 4.0
Currently v0.29.3
Privacy | Cookies
 
Links
Home 
About 
Docs 
Components 
Releases 
Guides
Getting Started 
Developing Modules 
Optimization 
Versioning 
Community
Issues   
Discussions   
Contribute 
Hinode
Code copied to clipboard