From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.devel Subject: Adding icon sets to Emacs -- and next steps for icons.el Date: Tue, 23 Aug 2022 23:45:43 -0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7498"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Aug 24 08:52:23 2022 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 1oQkFS-0001pa-VU for ged-emacs-devel@m.gmane-mx.org; Wed, 24 Aug 2022 08:52:22 +0200 Original-Received: from localhost ([::1]:53118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQkFR-0006pl-8P for ged-emacs-devel@m.gmane-mx.org; Wed, 24 Aug 2022 02:52:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44996) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQk95-0002nU-UX for emacs-devel@gnu.org; Wed, 24 Aug 2022 02:45:55 -0400 Original-Received: from mail-vs1-xe33.google.com ([2607:f8b0:4864:20::e33]:41589) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQk92-00078k-SU for emacs-devel@gnu.org; Wed, 24 Aug 2022 02:45:47 -0400 Original-Received: by mail-vs1-xe33.google.com with SMTP id k2so16611976vsk.8 for ; Tue, 23 Aug 2022 23:45:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:mime-version :from:from:to:cc; bh=+Do/eF90kiSOqC4e1SkCtEAvDgLCpun768s/V7pkeDo=; b=gOzBIabTeTYASF+OnlcR/qCz+3weQilR/Z80QvpXJd0rj2gX7TJCF3yPaptlL220eY cFPLhJy7eWoXUN9QIvwOK+KMLNqVfzeAowJ4UBpaapvBzneXfN6MUIr1ilO5zy9Rs9cb wa8G6C0hQ2sawcAwgmVfWSqBcaiYuWkv31qkDk8Mu+CCuwCr7FpzVXsYHKTBcTq+i6tV sTVqhRoK3Qh6LEgGZ3zmoqk7IJUST0ohcgVcz+gw5YhfKQQhWuMjMed5QyJfrlqEO4gU WFJYEmXzHHQq7WNTQX14vCYrr6Phc4QlxX+66JDpfj9L/bei/Lwd9yjss798UanEH26j nj+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:mime-version :from:x-gm-message-state:from:to:cc; bh=+Do/eF90kiSOqC4e1SkCtEAvDgLCpun768s/V7pkeDo=; b=5utss6HK64KAJN1oztLq0bZ3F1XhtPZHY/A1xaUYOecWiCIuHNnwDVuaBko64SKCHE jDWDBIR+JTGIhbKGdQLO7AEakyIChLYMwaqOcRl7CufQo71PY+qGNG95DlwJ7aA2IgF2 APZ6T5dmjoOGVnKD4u5pMY2faY4ymtUVJoxWtEgRBc+JfUCb3M0DRPWuyCho92HuoHsa xXBzIKWk53jG1gCSyWK1269QHUd2FNbiNPtoAIlgXT2P8JVYcgDHYlvM7RnlE7xl6hKK JJSA7OGp71F2ZwkvNTM8DSnhXvfpK4CA4XMTDorafy9UjG5Oy/zomSxZnvOLK0jGGEdb SSXQ== X-Gm-Message-State: ACgBeo3RHEyORS1/DMLB4YVcHcaIwC5yMhrJkM3uFkHEhiKyVEEImt5S jO2Rzzpu0fOkGLgU8ieSZ8Iz9j5Qz/MH6HmX76yoyEu1 X-Google-Smtp-Source: AA6agR4ZtdYWTiXhrh/ERXtdngNavVXAhL0uG96mCMPw+URDfBPVxpfz2BY2qoi6OZluW87r44G91ckGd83zkoAOTOs= X-Received: by 2002:a05:6102:313b:b0:38f:7ffa:166c with SMTP id f27-20020a056102313b00b0038f7ffa166cmr10676658vsh.46.1661323543769; Tue, 23 Aug 2022 23:45:43 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 23 Aug 2022 23:45:43 -0700 Received-SPF: pass client-ip=2607:f8b0:4864:20::e33; envelope-from=stefankangas@gmail.com; helo=mail-vs1-xe33.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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:293959 Archived-At: Hi Emacs, I've procrastinated on this for long enough, so... I've just pushed the branch scratch/icons with my work from before Lars merged his icons.el. I intend to start finishing this up for merging to master, including properly merging it with Lars' work. The idea behind my icons.el is that a user should be able to switch out all icons at once (to get a consistent look) rather than having to customize a potentially large number of individual icons. The work that I've done therefore operate on a different level from Lars' work: it tries to map an icon name (currently a string) like "warning" to a concrete file, which could be, e.g., "material/alert/warning.svg" or "octicons/alert-16.svg". The exact file chosen will depend on the available icon sets, the user option `icons-set-priority', and the font size.[1] This means you can say: (icons-get "content/inventory") =3D> #(" " 0 1 (display (image :type svg :file ".../etc/images/material/content/inventory.svg" :scale 1.1052631578947367 :ascent center :height (1 . em) :transform-smoothing t))) (icons-get-filename "content/inventory") =3D> "/home/skangas/wip/emacs/etc/images/material/content/inventory.svg= " My idea is to keep Lars' idea of individual customizable icons, but leave the choice of which image file to the code I've written. I imagine that the `warnings-suppress' icon definition in warnings.el should look something like: (define-icon warnings-suppress button '((image "warning") ;;; <<< NEW LINE >>> (emoji "=E2=9B=94") (symbol " =E2=96=A0 ") (text " stop ")) "Suppress warnings." :version "29.1" :help-echo "Click to suppress this warning type") >From here, "warning" will be fed to my `icons-get', which will be responsible for producing, e.g., the ".../material/alert/warning.svg" file from the "materials" icon set, based on whatever knobs we decide to have. I have included material icons and octicons as two default sets, to be distributed with Emacs. (They would not be considered a part of Emacs and so don't need to be subject to copyright assignment.) More icon sets would be easy to add to either GNU ELPA or core later. To test this: build the scratch/icons branch, then check the main toolbar, `M-x list-icons', the `M-x mpc' toolbar, and `M-x compile'. Note that this is very much WIP still, but any comments are welcome. Footnotes: [1] Some icon sets provide more than one version of an icon, intended for viewing at smaller and larger sizes. So asking for "warning" should give you either "octicons/alert-16.svg" or "octicons/alert-24.svg" depending on the size of the default face.