Giter Club home page Giter Club logo

delphidarkmode's Introduction

DelphiDarkMode

Detecting and acting on Windows' Dark Mode theme setting in Delphi

Originally written by Ian Barker

There is a blog post describing this code and the reasoning behind it here: https://www.codedotshow.com/blog/coderage-2019-vcl-the-dark-side/

Free software - use for any purpose including commercial use.

Functions


function DarkModeIsEnabled: boolean; Checks the Windows registry to see if Windows Dark Mode is enabled


procedure SetAppropriateThemeMode(const DarkModeThemeName, LightModeThemeName: string);

Automatically sets a Dark Mode theme if Windows is running in Dark Mode To use:

  1. Got to project properties
  2. Select appearance and choose two or more themes. Note down the names!
  3. In your FormCreate (or wherever) put the following line: SetAppropriateThemeMode(**name_of_the_dark_theme**, **name_of_the_non_dark_theme**);

For example:

SetAppropriateThemeMode('Carbon', 'Windows10');


procedure SetSpecificThemeMode(const AsDarkMode: Boolean; const DarkModeThemeName, LightModeThemeName: string);

Sets either a Dark Mode or non Dark mode theme based in the "AsDarkMode" boolean For example:

SetSpecificThemeMode(False, 'TheDarkModeThemeName', 'TheLightModeThemeName');

Would change the application theme to the theme with the name 'TheLightModeThemeName' if it exists.

End of document

delphidarkmode's People

Contributors

checkdigits avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

delphidarkmode's Issues

Add FMX version

Could use some conditional defines I think to check if the project is FMX or VCL one and use the appropriate Style management unit. The more or less the rest of the code should be the same

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.