From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: ams@gnu.org (Alfred M. Szmidt) Newsgroups: gmane.emacs.devel Subject: toggle-light-dark-mode (was: Re: "modern" colors Re: Changes for emacs 28) Date: Tue, 15 Sep 2020 02:54:40 -0400 Message-ID: References: <20200910102000.2t6tsju745xutg7u@Ergus> <20200910110832.ko66gqnqo4l664d6@Ergus> <20200911134225.zhnlq7cdhmu2iraj@Ergus> <20200911221435.go7b5kz2zcvxp2ft@Ergus> <20200912153723.ymnq3i5pugqf7lsy@Ergus> <20200912194652.nrcx2fjg7n4j54ns@Ergus> <87blia32b7.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38748"; mail-complaints-to="usenet@ciao.gmane.io" Cc: spacibba@aol.com, casouri@gmail.com, emacs-devel@gnu.org, monnier@iro.umontreal.ca, ghe@sdf.org, tecosaur@gmail.com To: Caio Henrique Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Sep 15 08:57:44 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kI4uN-0009yZ-WB for ged-emacs-devel@m.gmane-mx.org; Tue, 15 Sep 2020 08:57:43 +0200 Original-Received: from localhost ([::1]:34752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kI4uN-0000BN-1w for ged-emacs-devel@m.gmane-mx.org; Tue, 15 Sep 2020 02:57:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kI4rR-0005Zi-6G for emacs-devel@gnu.org; Tue, 15 Sep 2020 02:54:41 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:39606) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kI4rQ-0000Ev-CN; Tue, 15 Sep 2020 02:54:40 -0400 Original-Received: from ams by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1kI4rQ-0006po-0Y; Tue, 15 Sep 2020 02:54:40 -0400 In-reply-to: <87blia32b7.fsf@gmail.com> (message from Caio Henrique on Sat, 12 Sep 2020 22:14:52 -0300) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:255712 Archived-At: [Tip, it is a good idea to change the subject!] I like using a light theme during the day and a dark theme during the night when I'm in a dark room. I use a function to toggle between those two different themes. Here is some code based on my personal configuration: _____ (defun toggle-light-dark-theme--custom-choices (theme) "Function used to create the choice widget options of the toggle-light-dark-theme custom variables." `(const :tag ,(symbol-name theme) ,theme)) (defcustom toggle-light-dark-theme-light-theme 'modus-operandi "The light theme that the function toggle-light-dark-theme will use." :type `(choice ,@(mapcar #'toggle-light-dark-theme--custom-choices (custom-available-themes)))) (defcustom toggle-light-dark-theme-dark-theme 'tango-dark "The dark theme that the function toggle-light-dark-theme will use." :type `(choice ,@(mapcar #'toggle-light-dark-theme--custom-choices (custom-available-themes)))) (defvar toggle-light-dark-theme--current-theme 'light) (defun toggle-light-dark-theme () "Disables all custom enabled themes and then toggles between a light and a dark theme, which are the values of the variables toggle-light-dark-theme-light-theme and toggle-light-dark-theme-dark-theme." (interactive) (mapc #'disable-theme custom-enabled-themes) (cond ((eq toggle-light-dark-theme--current-theme 'light) (load-theme toggle-light-dark-theme-dark-theme) (setq toggle-light-dark-theme--current-theme 'dark)) (t (load-theme toggle-light-dark-theme-light-theme) (setq toggle-light-dark-theme--current-theme 'light)))) _____ Maybe we could use something like this and then add buttons to the menu and the tool bar? The tool bar could use an icon like the image attached (the image is just illustrative, it probably has copyright). This looks like a good idea. I think something in the tool-bar is a bit much, I don't think it is the most used option that should that have such a high visibility -- rather I think users would like to toggle it once, so the menu-bar would be a better place where the user would also be prompt to save their settings if they quit emacs. Would you like to purpose a patch for this?