unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefankangas@gmail.com>
To: emacs-devel@gnu.org
Subject: Adding icon sets to Emacs -- and next steps for icons.el
Date: Tue, 23 Aug 2022 23:45:43 -0700	[thread overview]
Message-ID: <CADwFkmnOsrwZ3Zq=D99N7PHHFzmw4wFHnzUTN40hixZYmYVj2Q@mail.gmail.com> (raw)

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")
    => #(" " 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")
    => "/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 "⛔")
        (symbol " ■ ")
        (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.



             reply	other threads:[~2022-08-24  6:45 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-24  6:45 Stefan Kangas [this message]
2022-08-24  6:56 ` Adding icon sets to Emacs -- and next steps for icons.el Po Lu
2022-08-24  7:20 ` Stefan Kangas
2022-08-24 11:25 ` Lars Ingebrigtsen
  -- strict thread matches above, loose matches on Subject: below --
2022-08-24 12:43 Angelo Graziosi
2022-08-24 13:05 ` Dmitry Gutov
2022-08-24 13:22   ` Eli Zaretskii
2022-08-24 13:26     ` Visuwesh
2022-08-24 14:19       ` Eli Zaretskii
2022-08-24 14:32         ` Visuwesh
2022-08-24 16:23         ` Stefan Monnier
2022-08-24 16:34           ` Eli Zaretskii
2022-08-25  1:11       ` Po Lu
2022-08-25  1:35         ` Visuwesh
2022-08-24 13:36     ` Po Lu
2022-08-24 13:51       ` Angelo Graziosi
2022-08-24 16:40       ` Stefan Kangas
2022-08-24 13:46     ` Angelo Graziosi
2022-08-24 13:47     ` Dmitry Gutov
2022-08-24 13:58       ` Po Lu
2022-08-24 14:26         ` Dmitry Gutov
2022-08-25  1:10           ` Po Lu
2022-08-25  1:22             ` Dmitry Gutov
2022-08-25  2:34               ` Po Lu
2022-08-24 23:09     ` Stefan Kangas
2022-08-25  1:23       ` Po Lu
2022-08-25  5:39         ` Eli Zaretskii
2022-08-25  6:49           ` Po Lu
2022-08-25 11:01       ` Visuwesh
2022-09-07 20:03         ` Jean Louis
2022-09-08  8:18           ` Po Lu
2022-09-08  8:25             ` Dmitry Gutov
2022-09-08  8:37             ` Jean Louis
2022-09-08 10:38               ` Po Lu
2022-08-25 21:26       ` Rudolf Adamkovič
2022-09-08 11:00         ` Jean Louis
2022-09-09 11:04           ` Rudolf Adamkovič
2022-08-25  9:28   ` Lars Ingebrigtsen
2022-09-07 19:11 ` Jean Louis
2022-08-24 16:08 Payas Relekar
2022-08-24 18:10 ` Dmitry Gutov
2022-08-25  1:39   ` Visuwesh
2022-08-25  5:28     ` Tim Cross
2022-09-08 10:03 Payas Relekar
2022-09-08 11:44 ` Dmitry Gutov
2022-09-09  3:03   ` Richard Stallman
2022-09-08 12:19 Payas Relekar
2022-09-08 14:03 ` Po Lu
2022-09-08 14:11   ` Payas Relekar
2022-09-08 21:24 ` Stefan Kangas
2022-09-09  1:48   ` Po Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADwFkmnOsrwZ3Zq=D99N7PHHFzmw4wFHnzUTN40hixZYmYVj2Q@mail.gmail.com' \
    --to=stefankangas@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).