How to set iTerm2 color to darkmode with powerlevel10k

2 min read 04-10-2024
How to set iTerm2 color to darkmode with powerlevel10k


Ditch the Bright Lights: Achieving a Dark Mode iTerm2 with Powerlevel10k

Tired of blinding terminal windows and longing for the soothing embrace of dark mode? Powerlevel10k, a popular theme for your terminal, can be your ally in this quest for visual serenity. Let's guide you through the steps to achieve the perfect dark mode setup in iTerm2, enhancing both your terminal's aesthetics and your coding experience.

The Scenario:

Imagine you've installed Powerlevel10k, eager to transform your terminal into a visually pleasing workspace. You navigate through themes, customize fonts, and tweak colors, but still, a glaring white background persists, straining your eyes. This is where we step in!

Original Code:

# Sample Powerlevel10k configuration
POWERLEVEL9K_MODE="nerdfont-complete"
POWERLEVEL9K_PROMPT_COMMAND="source /usr/local/bin/powerlevel9k/powerlevel9k.zsh"

The Solution:

While Powerlevel10k offers a range of customizations, dark mode isn't automatically enabled. Here's how to remedy that:

  1. Enable Dark Mode in iTerm2:

    • Open iTerm2's Preferences.
    • Navigate to Profiles > Colors.
    • Choose a dark color scheme (e.g., "Solarized Dark" or "Dracula").
  2. Adjust Powerlevel10k Colors:

    • Open your .zshrc file (usually located in your home directory).
    • Find the following line: POWERLEVEL9K_THEME="some-theme"
    • Replace "some-theme" with a dark-themed Powerlevel10k theme. Popular options include:
      • "dark"
      • "dracula"
      • "solarized-dark"
  3. Customize Further (Optional):

    • Powerlevel10k offers extensive color customization. Explore the documentation for detailed instructions.
  4. Restart iTerm2: For changes to take effect, restart your iTerm2 application.

Additional Insights:

  • Powerlevel10k Themes: While Powerlevel10k provides default themes, consider browsing the community-made themes on GitHub for even more options.
  • Color Palette Compatibility: Ensure that the iTerm2 color scheme and Powerlevel10k theme are compatible, as they might use different color palettes.
  • Visual Accessibility: Consider using high-contrast colors for improved visual accessibility, especially if you experience eye strain.

Enhanced Readability:

By adopting a dark mode setup, you'll enjoy a visually appealing and comfortable terminal environment. Dark backgrounds reduce eye fatigue, allowing you to focus better on your code and tasks.

In Conclusion:

Achieving a dark mode iTerm2 with Powerlevel10k is a simple process that offers a significant improvement in your coding experience. By carefully choosing a dark color scheme and a compatible Powerlevel10k theme, you can transform your terminal into a tranquil and productive workspace.