[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Computing value from list lengths

From: fatiparty
Subject: Computing value from list lengths
Date: Fri, 21 Jan 2022 13:19:18 +0100 (CET)

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)
  (defmacro colour-typeface ()

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

      (dotimes (i 8)
         `( 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 )

      `(progn ,@faces) ) ))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]