Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id AB2C74196F3 for ; Mon, 26 Apr 2010 02:25:31 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DO7auzRM50XU for ; Mon, 26 Apr 2010 02:25:30 -0700 (PDT) Received: from mail-ww0-f53.google.com (mail-ww0-f53.google.com [74.125.82.53]) by olra.theworths.org (Postfix) with ESMTP id 392924196F0 for ; Mon, 26 Apr 2010 02:25:30 -0700 (PDT) Received: by wwi18 with SMTP id 18so277984wwi.26 for ; Mon, 26 Apr 2010 02:25:29 -0700 (PDT) Received: by 10.216.160.8 with SMTP id t8mr4606196wek.101.1272273926512; Mon, 26 Apr 2010 02:25:26 -0700 (PDT) Received: from ut.hh.sledj.net (host83-217-165-81.dsl.vispa.com [83.217.165.81]) by mx.google.com with ESMTPS id d16sm833411wej.21.2010.04.26.02.25.24 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 26 Apr 2010 02:25:25 -0700 (PDT) Received: by ut.hh.sledj.net (Postfix, from userid 1000) id 800B1594135; Mon, 26 Apr 2010 10:25:35 +0100 (BST) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH 1/3] emacs: Adapt the logo background colour to that of the frame Date: Mon, 26 Apr 2010 10:25:28 +0100 Message-Id: <1272273930-30997-1-git-send-email-dme@dme.org> X-Mailer: git-send-email 1.7.0 In-Reply-To: <87iq7i2aia.fsf@yoom.home.cworth.org> References: <87iq7i2aia.fsf@yoom.home.cworth.org> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Apr 2010 09:25:31 -0000 The notmuch logo uses transparency. That can display poorly when inserting the image into an emacs buffer (black logo on a black background), so force the background colour of the image. We use a face (`notmuch-hello-logo-background') to represent the colour so that `defface' can be used to declare the different possible colours, which depend on whether the frame has a light or dark background. --- emacs/notmuch-hello.el | 25 +++++++++++++++++-------- 1 files changed, 17 insertions(+), 8 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 482ef68..3a74ebd 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -55,9 +55,14 @@ :type 'boolean :group 'notmuch) -(defcustom notmuch-hello-logo-background "#5f5f5f" +(defface notmuch-hello-logo-background + '((((class color) + (background dark)) + (:background "#5f5f5f")) + (((class color) + (background light)) + (:background "white"))) "Background colour for the notmuch logo." - :type 'color :group 'notmuch) (defcustom notmuch-hello-jump-to-search t @@ -209,12 +214,16 @@ diagonal." (when notmuch-hello-show-logo (let ((image notmuch-hello-logo)) - ;; dme: Sorry, I don't know any other way to achieve this :-( The - ;; notmuch logo uses transparency. That works out badly when - ;; inserting the image into an emacs buffer, so force the - ;; background colour of the image. - (setq image (cons 'image (append (cdr image) - `(:background ,notmuch-hello-logo-background)))) + ;; The notmuch logo uses transparency. That can display poorly + ;; when inserting the image into an emacs buffer (black logo on + ;; a black background), so force the background colour of the + ;; image. We use a face to represent the colour so that + ;; `defface' can be used to declare the different possible + ;; colours, which depend on whether the frame has a light or + ;; dark background. + (setq image (cons 'image + (append (cdr image) + (list :background (face-background 'notmuch-hello-logo-background))))) (insert-image image)) (widget-insert " ")) -- 1.7.0