/retool-tutorials

How to enable dark mode in Retool?

Learn how to enable dark mode in Retool using CSS to enhance visual comfort. Follow this guide for settings, custom styling, testing, and deployment.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web or mobile app? RapidDev builds Retool apps with your growth in mind.

Book a free No-Code consultation

How to enable dark mode in Retool?

 

Enabling Dark Mode in Retool

 

Incorporating a dark mode in Retool applications enhances visual comfort during extended usage, especially in low-light environments. While Retool offers a range of customizable options, enabling a dark theme involves leveraging CSS and understanding Retool's environment. Below is a comprehensive guide on how to enable dark mode in Retool.

 

Prerequisites

 

  • Basic understanding of CSS (Cascading Style Sheets).
  • Access to a Retool account with the appropriate permissions to modify the app.
  • Familiarity with Retool's interface and component structure.

 

Accessing Custom Styling Options

 

  • Log in to your Retool account and open the application for which you want to enable dark mode.
  • Navigate to the Settings option in the top header to explore app customization options.

 

Using CSS to Enable Dark Mode

 

  • In the application settings or main editing interface, locate the CSS section reserved for custom styling.
  • Input global-level CSS that targets the background, text colors, and other visual elements. Example CSS for dark mode:
    <pre>
    body {
      background-color: #121212;
      color: #ffffff;
    }
    
    .component-class {
      background-color: #1e1e1e;
      border-color: #333333;
    }
    
    a {
      color: #bb86fc;
    }
    </pre>
    
  • Customize the CSS as needed to fit the unique components of your Retool application. Consider headers, tables, buttons, and other UI components.

 

Applying the CSS to Specific Components

 

  • To apply styles to specific Retool components, use the developer tools to inspect the component and identify its class or ID.
  • Write targeted CSS rules for individual components if a global dark mode setting alters the appearance undesirably.
  • Example:
        #specific-component-id {
          background-color: #2c2c2c;
          color: #ececec;
        }
        

 

Testing and Adjustments

 

  • After implementing the CSS, switch to the preview mode to examine how the dark mode influences the app's display.
  • Check all pages and components for visibility and readability. Conduct usability testing to ensure a positive user experience.
  • Adjust font sizes, colors, and spacing if necessary to facilitate better readability in dark mode.

 

Implementing Dark Mode Toggle

 

  • Create a toggle button or switch in your Retool application UI to allow users to switch between light and dark modes.
  • Use a JavaScript query or event handler that triggers the dark mode CSS dynamically based on user interaction.
  • Example JavaScript toggling:
    <pre>
    function toggleDarkMode() {
      const bodyClass = document.body.classList;
      bodyClass.contains('dark-mode') ? bodyClass.remove('dark-mode') : bodyClass.add('dark-mode');
    }
    </pre>
    
  • Add corresponding CSS rules that are conditionally applied.
    <pre>
    .dark-mode body {
      background-color: #121212;
      color: #ffffff;
    }
    </pre>
    

 

Deploying the Application

 

  • Once all the dark mode adjustments are complete, deploy the application by clicking Publish Changes in Retool.
  • Verify the dark mode implementation across different browsers and devices to ensure compatibility and performance.

 

By following these steps, you can successfully implement a dark mode feature in your Retool application, enhancing the aesthetic appeal and usability for users working under various lighting conditions.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022