0

I'm trying to define a color set (from material color) in order to be able to easily change the set I want to use. I think I've managed to define them but then, I'm not able to use them properly. I guess the last line below is problematic (I got a wrong argument when evaluating it) but I'm not familiar enough with lisp to fix it.

;; Material colors from https://material.io/design/color/
(defconst deep-purple '((level-100  "#D1C4E9")
                        (level-200  "#B39DDB")
                        (level-300  "#9575CD")
                        (level-400  "#7E57C2")
                        (level-500  "#673AB7")
                        (level-600  "#5E35B1")
                        (level-700  "#512DA8")
                        (level-800  "#4527A0")
                        (level-900  "#311B92")
                        (level-A100 "#B388FF")
                        (level-A200 "#7C4DFF")
                        (level-A400 "#651FFF")
                        (level-A700 "#6200EA")))

;; Get a material color 
(defun color (hue level)
  "Return the color from the given shade-list and specified shade."
  (cdr (assoc level hue)))

;; Define default hue
(defconst default-hue deep-purple)

;; Get some color
(defconst background-color (color default-hue 'level-700))

;; Problematic line
(set-face-attribute 'mode-line nil
                :weight 'regular
                :background background-color
                :box `(:line-width 1 :color background-color :style nil))
Nicolas Rougier
  • 487
  • 3
  • 15
  • If you want to interpolate a variable into a backtick quoted list, you'll need to put a comma in front of it. –  Jan 13 '19 at 14:27
  • What I'm trying to achieve is to: 1. define some set of predefined colors (deep-purple) 2. define some colors based on the selected set 3. use these colors to set various faces. The source above has been written by mostly copying various sources but since I'm not familiar enough with lisp, maybe my solution is simply bad. – Nicolas Rougier Jan 13 '19 at 18:38
  • The sources I used are available at https://github.com/Jannis/emacs-constant-theme/blob/master/constant-theme.el – Nicolas Rougier Jan 13 '19 at 18:47

0 Answers0