unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Computing value from list lengths
@ 2022-01-21 12:19 fatiparty--- via Users list for the GNU Emacs text editor
  2022-01-21 12:27 ` Emanuel Berg via Users list for the GNU Emacs text editor
       [not found] ` <MtwZuNw--3-2@tutanota.com-Mtw_GyL----2>
  0 siblings, 2 replies; 7+ messages in thread
From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-01-21 12:19 UTC (permalink / raw)
  To: Help Gnu Emacs

I have the following code and want to determine maxdepth
automatically from the length of the dark-theme-colours and
light-theme-colours (and changing the ahrd coded (dotimes (i 8)).

What would be the strategy?


(defcustom maxdepth 8
  "Number of faces defined for colouring brace marks.
Determines depth at which to cycle through faces again."
  :type 'integer
  :group 'test)
(eval-when-compile
  (defmacro colour-typeface ()

    ( let ( (faces '())
            (dark-theme-colours
             [ "#ff62d4" "#3fdfd0" "#fba849" "#9f80ff"
           "#4fe42f" "#fe6060" "#4fafff" "#f0dd60" ])
        (light-theme-colours
             [ "#a8007f" "#005f88" "#904200" "#7f10d0"
           "#006800" "#b60000" "#1f1fce" "#605b00" ]) )

      (dotimes (i 8)
        (push
         `( defface ,(intern (format "depth-%d-face" (1+ i)))
            '( (default (:inherit richerenkov-base-face))
               ( ((class color) (background dark))
                 :foreground ,(aref dark-theme-colours  i) )
               ( ((class color) (background light))
                 :foreground ,(aref light-theme-colours i) ))
            ,(format "Nested delimiter face, depth %d." (1+ i) )
            :group 'colour-faces )
         faces))

      `(progn ,@faces) ) ))

(colour-typeface)





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-01-23  3:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-21 12:19 Computing value from list lengths fatiparty--- via Users list for the GNU Emacs text editor
2022-01-21 12:27 ` Emanuel Berg via Users list for the GNU Emacs text editor
     [not found] ` <MtwZuNw--3-2@tutanota.com-Mtw_GyL----2>
2022-01-21 13:56   ` fatiparty--- via Users list for the GNU Emacs text editor
2022-01-21 15:36     ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-01-21 16:26       ` fatiparty--- via Users list for the GNU Emacs text editor
2022-01-21 20:50         ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-01-23  3:29           ` fatiparty--- via Users list for the GNU Emacs text editor

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).