Giter VIP home page Giter VIP logo

exceldarkmode's Introduction

ExcelDarkMode

Customisable Dark Mode for Excel cell backgrounds.

VBA based but will work on non-macro workbooks if you save it to your Personal workbook (see below).

This works by replacing the colour definitions for styles already defined in the workbook (rather than creating new styles).

Don't forget to toggle a workbook back to light mode before you share it with uninitiated friends!

ExcelDarkMode

Setup

To set this up you'll need to copy some VBA code into a new macro. Follow the links below to the code, and to support articles on creating personal macros and calling them from your quick access bar:

  1. Copy the code from DarkMode.vba to a new module in your PERSONAL.XLSB, save.
  2. Run the macro ToggleDarkMode to switch between dark and light modes
  3. For ease of use, add the macro to your Quick Access bar

Since added DarkMode2.vba

Customisation

To change the dark mode colours, change the Hex colour code parameters in the DarkMode Function:

   Call UpdateStyleColors(styleName:="Normal", fillColorHex:="#2E3440", fontColorHex:="#FFFFFF", borderColorHex:="#454545")

To find the Hex codes for your favourite colours, use the font colour 'More Colors' picker (and copy the Hex code from the bottom):

image

To set dark mode for a new style, copy the Call UpdateStyleColors... line and provide the style name. Don't forget to add the style to the LightMode Function as well.

What if it doesn't work for all cells?

This approach only works for cell styles. Cells which have had font/fill colours applied in addition to the cell style will not be darkened, since the additional formatting overrides cell style formatting.

For dark mode to work for these cells, you need to re-apply a cell style to these cells. Beware that this will remove ALL additional formatting on the cell that isn't defined in a style.

There's a macro ResetStyles to assist removing additional formatting so you can apply styles properly to a pre-existing workbook. Use with caution. Either save a copy of the file or copy the formatting/sheet to a new workbook to save the original formatting until you're happy with your changes. In some cases you may be better off selecting individual regions, clearing formatting manually.

It may take a bit of time to undo formatting and replace with proper cell styles for a pre-existing Workbook but this is good practice and should hopefully be a one-off activity. Or just accept that not all cells will be darkened.

Font colour isn't lightened

If the cell background gets darkedned but the font colour doesn't change (ie dark text on dark background), it's most likely because the font colour has been changed for those cells. This is a variation of the case in the section above - to fix you'd need to reapply a style to these cells

Known issues

  • Formatting in addition to a cell style (see above)
  • Table styles get reset when switching back to light mode
  • Doesn't work for cells where the formatting is locked

Feedback welcome

To send feedback, head to the GitHub repository and create a new issue.

Copyright

Copyright (c) 2021 Stuart Bell

Licenced under the MIT licence

exceldarkmode's People

Contributors

stu0292 avatar stu-bell avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.