Compare commits

...
22 Commits
Author SHA1 Message Date
Paul Provost a4a55082a1 Better inactive modeline background 2023-12-08 12:09:13 -05:00
paul aadc93331a Lighter ompilation line and column number 2023-09-22 12:10:57 -04:00
paul 2b9368fcc4 Better compilation info foreground for light background 2023-09-22 12:04:58 -04:00
paul d19920d5c4 Merge branch 'master' of ssh://git.home.bouzou.org:222/paul/emacs-petrol-theme 2023-07-28 10:39:52 -04:00
paul 9500f55ee2 Added colours for dired-subtree 2023-07-28 10:39:30 -04:00
paul e50bfe24a9 Added face for org-mode verbatim text 2022-06-10 17:15:30 +00:00
paul c420d640aa Do not strike through org headlines when they are DONE 2022-04-27 09:45:38 -04:00
paul 6ed02ff100 Merge branch 'master' of ssh://git.home.bouzou.org:222/paul/emacs-petrol-theme 2022-03-19 10:33:19 -04:00
paul 32c34caa4f Green tables 2022-03-19 10:33:07 -04:00
paul 4d0d86730c w3m faces - untested 2020-06-18 10:00:52 -04:00
Paul Provost b28b826813 Mass deboldify 2020-05-05 18:43:55 -04:00
paul 6da4feddff Better fringe colors 2020-03-03 20:27:06 -05:00
Paul Provost b401cadc14 Taller modeline 2020-02-28 15:47:12 -05:00
Paul Provost 1c15aae678 Smaller line numbers 2020-02-28 12:59:59 -05:00
paul 055d16a3c4 Line number gutter display 2020-02-28 12:37:20 -05:00
paul 7488bcfdf9 Installed petrol-blue for existing colors 2020-02-28 09:37:27 -05:00
paul 6e558f43df Installed petrol-purple and removed an underline 2020-02-27 17:30:27 -05:00
paul f1a4746135 Reverted technique from zenburn
Uses self-generating code, which is difficult to read and debug.
2020-02-27 07:24:52 -05:00
Paul Provost 589a48ba6c Working version with Color palette and faces palette 2020-02-26 14:36:51 -05:00
paul 1073faabad Merge branch 'master' of ssh://git.home.bouzou.org:222/paul/emacs-petrol-theme 2020-02-25 19:34:02 -05:00
paul 810fb161de Initial structure mods. Untested. 2020-02-23 18:28:31 -05:00
paul 7f3788b6ae Added a notes file 2020-02-23 18:26:56 -05:00
2 changed files with 193 additions and 493 deletions
+17
View File
@@ -0,0 +1,17 @@
#+TITLE: Notes on the Petrol theme
#+AUTHOR: Paul Provost
#+EMAIL: paul@provost.one
#+DESCRIPTION:
#+FILETAGS:
* Links
** Inspiration
- [[https://github.com/fniessen/emacs-leuven-theme][leuven]]
- [[https://github.com/vallyscode/cloud-theme][cloud]]
** Tools
- From [[https://explog.in/notes/poet.html][Making Poet, an Emacs theme]]
- [[http://paletton.com/#uid=34K190kr6u-blKMk5ypvBoeFHhn][Paletton - The Color Scheme Designer]]
- [[https://coolors.co/1a181b-5d4d66-703d89-9e2bd8-a304f2][Generate - Coolors.co]]
- [[https://www.c82.net/werner/#color-chocolate-red][Werners Nomenclature of Colours]]
- [[https://www.smashingmagazine.com/2010/02/color-theory-for-designer-part-3-creating-your-own-color-palettes/][Color Theory for Designers: How To Create Your Own Color Schemes — Smashing Magazine]]
+176 -493
View File
@@ -1,12 +1,12 @@
;;; petrol-theme.el --- A light colored theme -*- lexical-binding: t -*- ;;; petrol-theme.el --- A light colored theme -*- lexical-binding: t -*-
;; Copyright (C) 2019 Valerii Lysenko ;; Copyright (C) 2020 Paul Provost
;; Author: Valerii Lysenko <vallyscode@gmail.com> ;; Author: Paul Provost <paul@provost.one>
;; Maintainer: Valerii Lysenko <vallyscode@gmail.com> ;; Maintainer: Paul Provost <paul@provost.one>
;; Keywords: color theme ;; Keywords: color theme
;; Package-Version: 20200221.2201 ;; Package-Version: 2020mmdd.xxxx
;; URL: https://github.com/vallyscode/cloud-theme ;; URL: https://github.com/paulprovost/petrol-theme
;; Version: 0.1 ;; Version: 0.1
;; Package: petrol-theme ;; Package: petrol-theme
;; Package-Requires: ((emacs "24")) ;; Package-Requires: ((emacs "24"))
@@ -45,80 +45,122 @@
(deftheme petrol (deftheme petrol
"Petrol light color theme.") "Petrol light color theme.")
(let ((class '((class color) (min-colors 89)))) (let* ((class '((class color) (min-colors 89)))
;;,--------------------
;;| General variables.
;;`--------------------
(petrol-line-numbers-height (- (face-attribute 'default :height) 10))
;;,-----------------
;;| Generic colors.
;;`-----------------
(petrol-fg "#454545")
(petrol-bg "#f6f6ed")
(petrol-blue "#2f7e9d")
(petrol-orange "#cc6d00")
(petrol-purple "#6c4ca8")
(petrol-red "#d0372d")
;;,------------------
;;| Specific colors.
;;`------------------
(petrol-line-numbers-bg "#eaeae1")
;;,--------------------------
;;| Specific face fragments.
;;`--------------------------
(petrol-link `(:weight normal :foreground ,petrol-blue))
(petrol-link-visited `(:weight normal :foreground ,petrol-purple))
)
(custom-theme-set-faces (custom-theme-set-faces
'petrol 'petrol
`(default ((,class (:background "#f2f2f2" :foreground "#454545")))) `(default ((,class (:background ,petrol-bg :foreground ,petrol-fg))))
`(cursor ((,class (:background "#00638a" :foreground "#f2f2f2" )))) `(cursor ((,class (:background "#00638a" :foreground "#f2f2f2" ))))
`(fringe ((,class (:background "#f2f2f2" :foreground "#454545" )))) `(fringe ((,class (:background ,petrol-line-numbers-bg :foreground ,petrol-fg))))
`(border ((,class (:foreground "#2f7e9d")))) `(border ((,class (:foreground ,petrol-blue))))
`(vertical-border ((,class (:foreground "#2f7e9d")))) `(vertical-border ((,class (:foreground ,petrol-blue))))
`(highlight ((,class (:background "#fffbc4")))) `(highlight ((,class (:background "#fffbc4"))))
`(region ((,class (:background "#3389ab" :foreground "#f2f2f2")))) `(region ((,class (:background "#3389ab" :foreground "#f2f2f2"))))
`(secondary-selection ((,class (:weight bold :background "#fffbc4")))) `(secondary-selection ((,class (:background "#fffbc4"))))
`(isearch ((,class (:foreground "#f2f2f2" :background "#008abd")))) `(isearch ((,class (:foreground "#f2f2f2" :background "#008abd"))))
`(isearch-fail ((,class (:weight bold :foreground "#f2f2f2" :background "#d0372d")))) `(isearch-fail ((,class (:foreground "#f2f2f2" :background "#d0372d"))))
`(query-replace ((,class (:inherit isearch)))) `(query-replace ((,class (:inherit isearch))))
`(lazy-highlight ((,class (:foreground "#454545" :background "#fffbc4")))) ; Isearch others (see `match'). `(lazy-highlight ((,class (:foreground "#454545" :background "#fffbc4")))) ; Isearch others (see `match').
`(hl-line ((,class (:background "#ededed")))) `(hl-line ((,class (:background "#ededed"))))
`(shadow ((,class ((:foreground "#cccccc"))))) `(shadow ((,class ((:foreground "#cccccc")))))
`(match ((,class (:weight bold :background "#fffbc4")))) `(match ((,class (:background "#fffbc4"))))
`(show-paren-match ((,class (:background "#cccccc" :foreground "#2f7e9d")))) `(show-paren-match ((,class (:background "#cccccc" :foreground ,petrol-blue))))
`(show-paren-mismatch ((,class (:background "#cccccc" :foreground "#d0372d")))) `(show-paren-mismatch ((,class (:background "#cccccc" :foreground "#d0372d"))))
`(trailing-whitespace ((,class (:foreground "#cccccc" :background "#fffbc4")))) `(trailing-whitespace ((,class (:foreground "#cccccc" :background "#fffbc4"))))
`(button ((,class (:underline t :foreground "#2f7e9d")))) `(button ((,class (:foreground ,petrol-blue))))
`(help-argument-name ((,class (:foreground "#2f7e9d")))) `(help-argument-name ((,class (:foreground ,petrol-blue))))
`(info-menu-star ((,class (:foreground "#2f7e9d")))) `(info-menu-star ((,class (:foreground ,petrol-blue))))
`(next-error ((,class (:inherit error)))) `(next-error ((,class (:inherit error))))
`(nobreak-space ((,class (:background "#b48cff")))) `(nobreak-space ((,class (:background "#b48cff"))))
`(file-name-shadow ((,class (:foreground "#cccccc")))) `(file-name-shadow ((,class (:foreground "#cccccc"))))
`(line-number ((,class (:background "#f2f2f2" :foreground "#8c8c8c")))) `(line-number ((,class (:background ,petrol-line-numbers-bg
`(line-number-current-line ((,class (:background "#f2f2f2" :foreground "#cc6d00")))) :foreground "#8c8c8c"
:height ,petrol-line-numbers-height
))))
`(line-number-current-line ((,class (:background ,petrol-line-numbers-bg
:foreground "#cc6d00"
:height ,petrol-line-numbers-height
))))
`(linum ((,class (:background "#f2f2f2" :foreground "#8c8c8c")))) `(linum ((,class (:background "#f2f2f2" :foreground "#8c8c8c"))))
`(linum-highlight-face ((,class (:background "#f2f2f2" :foreground "#8c8c8c")))) `(linum-highlight-face ((,class (:background "#f2f2f2" :foreground "#8c8c8c"))))
`(font-lock-builtin-face ((,class (:foreground "#7d57c2")))) `(font-lock-builtin-face ((,class (:foreground ,petrol-purple))))
`(font-lock-comment-delimiter-face ((,class (:weight normal :foreground "#919aa1")))) `(font-lock-comment-delimiter-face ((,class (:weight normal :foreground "#919aa1"))))
`(font-lock-comment-face ((,class (:slant italic :weight normal :foreground "#919aa1")))) `(font-lock-comment-face ((,class (:weight normal :foreground "#919aa1"))))
`(font-lock-constant-face ((,class (:foreground "#008080")))) `(font-lock-constant-face ((,class (:foreground "#008080"))))
`(font-lock-doc-face ((,class (:slant italic :weight normal :foreground "#678f03")))) `(font-lock-doc-face ((,class (:weight normal :foreground "#678f03"))))
`(font-lock-function-name-face ((,class (:foreground "#454545")))) `(font-lock-function-name-face ((,class (:foreground "#454545"))))
`(font-lock-keyword-face ((,class (:weight bold :foreground "#00638a")))) `(font-lock-keyword-face ((,class (:foreground "#00638a"))))
`(font-lock-preprocessor-face ((,class (:foreground "#7d57c2")))) `(font-lock-preprocessor-face ((,class (:foreground ,petrol-purple))))
`(font-lock-regexp-grouping-backslash ((,class (:weight bold :inherit nil)))) `(font-lock-regexp-grouping-backslash ((,class (:inherit nil))))
`(font-lock-regexp-grouping-construct ((,class (:weight bold :inherit nil)))) `(font-lock-regexp-grouping-construct ((,class (:inherit nil))))
`(font-lock-string-face ((,class (:foreground "#678f03")))) `(font-lock-string-face ((,class (:foreground "#678f03"))))
`(font-lock-type-face ((,class (:weight bold :foreground "#008abd")))) `(font-lock-type-face ((,class (:foreground "#008abd"))))
`(font-lock-variable-name-face ((,class (:weight normal :foreground "#454545")))) `(font-lock-variable-name-face ((,class (:weight normal :foreground "#454545"))))
`(font-lock-warning-face ((,class (:weight bold :foreground "#cc6d00")))) `(font-lock-warning-face ((,class (:foreground "#cc6d00"))))
`(mode-line ((,class (:background "#2f7e9d" :foreground "#f2f2f2" :box (:line-width 1 :color "#2f7e9d"))))) `(mode-line ((,class (:background ,petrol-blue
`(mode-line-inactive ((,class (:background "#cccccc" :foreground "#f2f2f2" :box (:line-width 1 :color "#cccccc"))))) :foreground "#f2f2f2"
:box (:line-width 5 :color ,petrol-blue)
)
))
)
`(mode-line-inactive ((,class (:background "#1c4a5c"
:foreground "#f2f2f2"
:box (:line-width 5 :color "#1c4a5c")
)
))
)
`(mode-line-buffer-id ((,class (:weight bold)))) `(mode-line-buffer-id ((,class (:weight bold))))
`(mode-line-emphasis ((,class (:foreground "#f2f2f2")))) `(mode-line-emphasis ((,class (:foreground "#f2f2f2"))))
`(mode-line-highlight ((,class (:background "#fffbc4" :foreground "#454545")))) `(mode-line-highlight ((,class (:background "#fffbc4" :foreground "#454545"))))
`(header-line ((,class (:background "#2f7e9d" :foreground "#f2f2f2" :box (:line-width 1 :color "#2f7e9d"))))) `(header-line ((,class (:background ,petrol-blue :foreground "#f2f2f2" :box (:line-width 1 :color ,petrol-blue)))))
`(header-line-highlight ((,class (:background "#fffbc4" :foreground "#454545")))) `(header-line-highlight ((,class (:background "#fffbc4" :foreground "#454545"))))
`(error ((,class (:weight bold :foreground "#d0372d")))) `(error ((,class (:foreground "#d0372d"))))
`(warning ((,class (:weight bold :foreground "#cc6d00")))) `(warning ((,class (:foreground "#cc6d00"))))
`(success ((,class (:weight bold :foreground "#2e994c")))) `(success ((,class (:foreground "#2e994c"))))
`(minibuffer-prompt ((,class (:weight bold :foreground "#2f7e9d")))) `(minibuffer-prompt ((,class (:foreground ,petrol-blue))))
`(minibuffer-noticeable-prompt ((,class (:weight bold :foreground "#2f7e9d")))) `(minibuffer-noticeable-prompt ((,class (:foreground ,petrol-blue))))
`(escape-glyph ((,class (:weight bold :foreground "#b48cff")))) `(escape-glyph ((,class (:foreground "#b48cff"))))
`(whitespace-hspace ((,class (:foreground "#cccccc")))) `(whitespace-hspace ((,class (:foreground "#cccccc"))))
@@ -126,22 +168,29 @@
`(whitespace-line ((,class (:foreground "#e67373" :background "#f2f2f2")))) `(whitespace-line ((,class (:foreground "#e67373" :background "#f2f2f2"))))
`(whitespace-tab ((,class (:background nil :foreground "#454545")))) `(whitespace-tab ((,class (:background nil :foreground "#454545"))))
`(whitespace-trailing ((,class (:background nil :foreground "#e67373")))) `(whitespace-trailing ((,class (:background nil :foreground "#e67373"))))
`(window-divider ((,class (:background "#2f7e9d")))) `(window-divider ((,class (:background ,petrol-blue))))
`(window-divider-first-pixel ((,class (:background "#2f7e9d")))) `(window-divider-first-pixel ((,class (:background ,petrol-blue))))
`(window-divider-last-pixel ((,class (:background "#2f7e9d")))) `(window-divider-last-pixel ((,class (:background ,petrol-blue))))
`(link ((,class (:underline t :foreground "#006c96")))) `(link ((,class ,petrol-link)))
`(link-visited ((,class (:underline t :foreground "#6c4ca8")))) `(link-visited ((,class ,petrol-link-visited)))
`(dired-header ((,class (:weight bold :foreground "#2f7e9d" :background "#f2f2f2")))) `(dired-header ((,class (:foreground ,petrol-blue :background "#f2f2f2"))))
`(dired-directory ((,class (:weight bold :foreground "#2f7e9d" :background "#f2f2f2")))) `(dired-directory ((,class (:foreground ,petrol-blue :background "#f2f2f2"))))
`(dired-ignored ((,class (:strike-through t :foreground "#d0372d")))) `(dired-ignored ((,class (:strike-through t :foreground "#d0372d"))))
`(dired-mark ((,class (:foreground "#d0372d" :background "#f2f2f2")))) `(dired-mark ((,class (:foreground "#d0372d" :background "#f2f2f2"))))
`(dired-marked ((,class (:foreground "#d0372d" :background "#ffdddd")))) `(dired-marked ((,class (:foreground "#d0372d" :background "#ffdddd"))))
`(dired-symlink ((,class (:foreground "#855dcf")))) `(dired-symlink ((,class (:foreground "#855dcf"))))
`(dired-subtree-depth-1-face ((,class (:foreground ,petrol-blue :background "#f2f2f2"))))
`(dired-subtree-depth-2-face ((,class (:foreground ,petrol-blue :background "#f2f2f2"))))
`(dired-subtree-depth-3-face ((,class (:foreground ,petrol-blue :background "#f2f2f2"))))
`(dired-subtree-depth-4-face ((,class (:foreground ,petrol-blue :background "#f2f2f2"))))
`(dired-subtree-depth-5-face ((,class (:foreground ,petrol-blue :background "#f2f2f2"))))
`(dired-subtree-depth-6-face ((,class (:foreground ,petrol-blue :background "#f2f2f2"))))
`(diff-added ((,class (:background "#ddffdd" :foreground "#22863a")))) `(diff-added ((,class (:background "#ddffdd" :foreground "#22863a"))))
`(diff-removed ((,class (:background "#ffdddd" :foreground "#d0372d")))) `(diff-removed ((,class (:background "#ffdddd" :foreground "#d0372d"))))
@@ -150,8 +199,8 @@
`(diff-refine-removed ((,class (:background "#eecccc")))) `(diff-refine-removed ((,class (:background "#eecccc"))))
`(diff-refine-changed ((,class (:background "#fce8c9")))) `(diff-refine-changed ((,class (:background "#fce8c9"))))
`(diff-header ((,class (:foreground "#8c8c8c" :background "#f2f2f2")))) `(diff-header ((,class (:foreground "#8c8c8c" :background "#f2f2f2"))))
`(diff-file-header ((,class (:foreground "#2f7e9d" :background "#f2f2f2")))) `(diff-file-header ((,class (:foreground ,petrol-blue :background "#f2f2f2"))))
`(diff-hunk-header ((,class (:weight bold :foreground "#6f42c1" :background "#f2f2f2")))) `(diff-hunk-header ((,class (:foreground "#6f42c1" :background "#f2f2f2"))))
`(diff-index ((,class (:foreground "#8c8c8c" :background "#f2f2f2")))) `(diff-index ((,class (:foreground "#8c8c8c" :background "#f2f2f2"))))
`(diff-indicator-added ((,class (:foreground "#22863a" :background "#ddffdd")))) `(diff-indicator-added ((,class (:foreground "#22863a" :background "#ddffdd"))))
`(diff-indicator-removed ((,class (:foreground "#d0372d" :background "#ffdddd")))) `(diff-indicator-removed ((,class (:foreground "#d0372d" :background "#ffdddd"))))
@@ -171,26 +220,26 @@
`(company-tooltip-common-selection ((,class (:weight normal :foreground "#f2f2f2")))) `(company-tooltip-common-selection ((,class (:weight normal :foreground "#f2f2f2"))))
`(company-tooltip-selection ((,class (:weight normal :foreground "#f2f2f2" :background "#2f7e9d")))) `(company-tooltip-selection ((,class (:weight normal :foreground "#f2f2f2" :background ,petrol-blue))))
`(company-tooltip-annotation-selection ((,class (:weight normal :foreground "eeeeee")))) `(company-tooltip-annotation-selection ((,class (:weight normal :foreground "eeeeee"))))
`(company-tooltip-common ((,class (:weight bold)))) `(company-tooltip-common ((,class (:weight bold))))
`(company-tooltip ((,class (:foreground "#454545" :background "#cccccc")))) `(company-tooltip ((,class (:foreground "#454545" :background "#cccccc"))))
`(company-tooltip-annotation ((,class (:weight normal :foreground "#7d57c2")))) `(company-tooltip-annotation ((,class (:weight normal :foreground ,petrol-purple))))
`(company-preview-common ((,class (:weight normal :foreground "#2f7e9d" :inherit hl-line)))) `(company-preview-common ((,class (:weight normal :foreground ,petrol-blue :inherit hl-line))))
`(company-scrollbar-bg ((,class (:background "#cccccc")))) `(company-scrollbar-bg ((,class (:background "#cccccc"))))
`(company-scrollbar-fg ((,class (:background "#8c8c8c")))) `(company-scrollbar-fg ((,class (:background "#8c8c8c"))))
`(eldoc-highlight-function-argument ((,class (:foreground "#008abd" :weight bold)))) `(eldoc-highlight-function-argument ((,class (:foreground "#008abd"))))
`(haskell-pragma-face ((,class (:foreground "#7d57c2")))) `(haskell-pragma-face ((,class (:foreground ,petrol-purple))))
`(haskell-keyword-face ((,class (:foreground "#2f7e9d")))) `(haskell-keyword-face ((,class (:foreground ,petrol-blue))))
`(haskell-operator-face ((,class (:foreground "#d70087")))) `(haskell-operator-face ((,class (:foreground "#d70087"))))
`(haskell-type-face ((,class (:weight bold :foreground "#008abd")))) `(haskell-type-face ((,class (:foreground "#008abd"))))
`(which-func ((,class (:foreground "#7d57c2")))) `(which-func ((,class (:foreground ,petrol-purple))))
`(undo-tree-visualizer-current-face ((,class (:foreground "#cc6d00")))) `(undo-tree-visualizer-current-face ((,class (:foreground "#cc6d00"))))
@@ -202,36 +251,36 @@
`(grep-context-face ((,class (:foreground "#919aa1")))) `(grep-context-face ((,class (:foreground "#919aa1"))))
`(grep-error-face ((,class (:foreground "#d0372D")))) `(grep-error-face ((,class (:foreground "#d0372D"))))
`(grep-hit-face ((,class (:foreground "#2f7e9d")))) `(grep-hit-face ((,class (:foreground ,petrol-blue))))
`(grep-match-face ((,class (:foreground nil :background nil :inherit match)))) `(grep-match-face ((,class (:foreground nil :background nil :inherit match))))
`(regex-tool-matched-face ((,class (:foreground nil :background nil :inherit match)))) `(regex-tool-matched-face ((,class (:foreground nil :background nil :inherit match))))
`(compilation-column-number ((,class (:foreground "#cc6d00")))) `(compilation-column-number ((,class (:foreground "#fa8500"))))
`(compilation-line-number ((,class (:foreground "#cc6d00")))) `(compilation-line-number ((,class (:foreground "#fa8500"))))
`(compilation-message-face ((,class (:foreground "#2f7e9d")))) `(compilation-message-face ((,class (:foreground ,petrol-blue))))
`(compilation-error ((,class (:foreground "#ff9999")))) `(compilation-error ((,class (:foreground "#ff9999"))))
`(compilation-warning ((,class (:foreground "#f4ad49")))) `(compilation-warning ((,class (:foreground "#f4ad49"))))
`(compilation-info ((,class (:foreground "#b4efb4")))) `(compilation-info ((,class (:foreground "#29bf29"))))
`(compilation-mode-line-fail ((,class (:foreground "#ff9999")))) `(compilation-mode-line-fail ((,class (:foreground "#ff9999"))))
`(compilation-mode-line-exit ((,class (:foreground "#b4efb4")))) `(compilation-mode-line-exit ((,class (:foreground "#29bf29"))))
`(compilation-mode-line-run ((,class (:foreground "#b48cff")))) `(compilation-mode-line-run ((,class (:foreground "#b48cff"))))
`(eglot-mode-line ((,class (:foreground "#f2f2f2" :weight bold)))) `(eglot-mode-line ((,class (:foreground "#f2f2f2"))))
`(xref-file-header ((,class (:weight bold :foreground "#2f7e9d" :background "#f2f2f2")))) `(xref-file-header ((,class (:foreground ,petrol-blue :background "#f2f2f2"))))
`(flycheck-info ((,class (:underline (:color "#2e994c" :style wave) :weight bold)))) `(flycheck-info ((,class (:underline (:color "#2e994c" :style wave)))))
`(flycheck-warning ((,class (:underline (:color "#cc6d00" :style wave) :weight bold)))) `(flycheck-warning ((,class (:underline (:color "#cc6d00" :style wave)))))
`(flycheck-error ((,class (:underline (:color "#d0372d" :style wave) :weight bold)))) `(flycheck-error ((,class (:underline (:color "#d0372d" :style wave)))))
`(flycheck-fringe-info ((,class (:foreground "#2e994c")))) `(flycheck-fringe-info ((,class (:foreground "#2e994c"))))
`(flycheck-fringe-warning ((,class (:foreground "#cc6d00")))) `(flycheck-fringe-warning ((,class (:foreground "#cc6d00"))))
`(flycheck-fringe-error ((,class (:foreground "#d0372d")))) `(flycheck-fringe-error ((,class (:foreground "#d0372d"))))
`(flycheck-warning ((,class (:underline (:color "#cc6d00" :style wave))))) `(flycheck-warning ((,class (:underline (:color "#cc6d00" :style wave)))))
`(flycheck-error ((,class (:underline (:color "#d0372d" :style wave))))) `(flycheck-error ((,class (:underline (:color "#d0372d" :style wave)))))
`(flycheck-error-list-line-number ((,class (:foreground "#7d57c2")))) `(flycheck-error-list-line-number ((,class (:foreground ,petrol-purple))))
`(helm-M-x-key ((,class (:foreground "#2e994c")))) `(helm-M-x-key ((,class (:foreground "#2e994c"))))
@@ -244,72 +293,77 @@
`(helm-selection-line ((,class (:background "#f2f2f2")))) `(helm-selection-line ((,class (:background "#f2f2f2"))))
`(helm-separator ((,class (:foreground "#454545")))) `(helm-separator ((,class (:foreground "#454545"))))
`(helm-visible-mark ((,class (:foreground "#d0372d" :background "#ffdddd")))) `(helm-visible-mark ((,class (:foreground "#d0372d" :background "#ffdddd"))))
`(helm-buffer-directory ((,class (:foreground "#2f7e9d" :weight normal)))) `(helm-buffer-directory ((,class (:foreground ,petrol-blue :weight normal))))
`(helm-buffer-file ((,class (:foreground "#454545")))) `(helm-buffer-file ((,class (:foreground "#454545"))))
`(helm-buffer-not-saved ((,class (:foreground "#f4ad49")))) `(helm-buffer-not-saved ((,class (:foreground "#f4ad49"))))
`(helm-buffer-process ((,class (:foreground "#d0372d")))) `(helm-buffer-process ((,class (:foreground "#d0372d"))))
`(helm-buffer-saved-out ((,class (:foreground "#d0372d")))) `(helm-buffer-saved-out ((,class (:foreground "#d0372d"))))
`(helm-buffer-size ((,class (:foreground "#cc6d00")))) `(helm-buffer-size ((,class (:foreground "#cc6d00"))))
`(helm-candidate-number ((,class (:foreground "#f2f2f2" :background "#cc6d00")))) `(helm-candidate-number ((,class (:foreground "#f2f2f2" :background "#cc6d00"))))
`(helm-ff-directory ((,class (:foreground "#2f7e9d" :weight bold)))) `(helm-ff-directory ((,class (:foreground ,petrol-blue))))
`(helm-ff-executable ((,class (:foreground "#2e994c")))) `(helm-ff-executable ((,class (:foreground "#2e994c"))))
`(helm-ff-file ((,class (:foreground "#454545")))) `(helm-ff-file ((,class (:foreground "#454545"))))
`(helm-ff-invalid-symlink ((,class (:foreground "#7d57c2" :background "#ffdddd")))) `(helm-ff-invalid-symlink ((,class (:foreground ,petrol-purple :background "#ffdddd"))))
`(helm-ff-symlink ((,class (:foreground "#7d57c2")))) `(helm-ff-symlink ((,class (:foreground ,petrol-purple))))
`(which-key-key-face ((,class (:foreground "#7d57c2" :weight bold)))) `(which-key-key-face ((,class (:foreground ,petrol-purple))))
`(which-key-special-key-face ((,class (:foreground "#d70087" :weight bold :height 1.1)))) `(which-key-special-key-face ((,class (:foreground "#d70087" :height 1.1))))
`(which-key-command-description-face ((,class (:foreground "#454545" )))) `(which-key-command-description-face ((,class (:foreground "#454545" ))))
`(which-key-group-description-face ((,class (:foreground "#2f7e9d")))) `(which-key-group-description-face ((,class (:foreground ,petrol-blue))))
`(which-key-separator-face ((,class (:foreground "#919aa1")))) `(which-key-separator-face ((,class (:foreground "#919aa1"))))
`(rainbow-delimiters-depth-1-face ((,class (:foreground "#00638a")))) `(rainbow-delimiters-depth-1-face ((,class (:foreground "#00638a"))))
`(rainbow-delimiters-depth-2-face ((,class (:foreground "#7d57c2")))) `(rainbow-delimiters-depth-2-face ((,class (:foreground ,petrol-purple))))
`(rainbow-delimiters-depth-3-face ((,class (:foreground "#008080")))) `(rainbow-delimiters-depth-3-face ((,class (:foreground "#008080"))))
`(rainbow-delimiters-depth-4-face ((,class (:foreground "#2e994c")))) `(rainbow-delimiters-depth-4-face ((,class (:foreground "#2e994c"))))
`(rainbow-delimiters-depth-5-face ((,class (:foreground "#00638a")))) `(rainbow-delimiters-depth-5-face ((,class (:foreground "#00638a"))))
`(rainbow-delimiters-depth-6-face ((,class (:foreground "#7d57c2")))) `(rainbow-delimiters-depth-6-face ((,class (:foreground ,petrol-purple))))
`(rainbow-delimiters-depth-7-face ((,class (:foreground "#008080")))) `(rainbow-delimiters-depth-7-face ((,class (:foreground "#008080"))))
`(rainbow-delimiters-depth-8-face ((,class (:foreground "#2e994c")))) `(rainbow-delimiters-depth-8-face ((,class (:foreground "#2e994c"))))
`(rainbow-delimiters-depth-9-face ((,class (:foreground "#00638a")))) `(rainbow-delimiters-depth-9-face ((,class (:foreground "#00638a"))))
`(rainbow-delimiters-depth-10-face ((,class (:foreground "#7d57c2")))) `(rainbow-delimiters-depth-10-face ((,class (:foreground ,petrol-purple))))
`(rainbow-delimiters-depth-11-face ((,class (:foreground "#008080")))) `(rainbow-delimiters-depth-11-face ((,class (:foreground "#008080"))))
`(rainbow-delimiters-depth-12-face ((,class (:foreground "#2e994c")))) `(rainbow-delimiters-depth-12-face ((,class (:foreground "#2e994c"))))
`(outline-1 ((,class (:height 1.3 :weight bold :foreground "#008abd")))) `(outline-1 ((,class (:height 1.3 :foreground "#008abd"))))
`(outline-2 ((,class (:height 1.2 :weight bold :foreground "#7d57c2")))) `(outline-2 ((,class (:height 1.2 :foreground ,petrol-purple))))
`(outline-3 ((,class (:height 1.1 :weight bold :foreground "#cc6d00")))) `(outline-3 ((,class (:height 1.1 :foreground "#cc6d00"))))
`(outline-4 ((,class (:height 1.0 :weight bold :foreground "#2e994c")))) `(outline-4 ((,class (:height 1.0 :foreground "#2e994c"))))
`(outline-5 ((,class (:height 1.0 :weight bold :foreground "#00638a")))) `(outline-5 ((,class (:height 1.0 :foreground "#00638a"))))
`(outline-6 ((,class (:height 1.0 :weight bold :foreground "#D0372D")))) `(outline-6 ((,class (:height 1.0 :foreground "#D0372D"))))
`(outline-7 ((,class (:height 1.0 :weight bold :foreground "#008080")))) `(outline-7 ((,class (:height 1.0 :foreground "#008080"))))
`(outline-8 ((,class (:height 1.0 :weight bold :foreground "#6c7378")))) `(outline-8 ((,class (:height 1.0 :foreground "#6c7378"))))
`(org-level-1 ((,class (:height 1.3 :weight bold :foreground "#008abd")))) `(org-level-1 ((,class (:height 1.3 :foreground "#008abd"))))
`(org-level-2 ((,class (:height 1.2 :weight bold :foreground "#7d57c2")))) `(org-level-2 ((,class (:height 1.2 :foreground ,petrol-purple))))
`(org-level-3 ((,class (:height 1.1 :weight bold :foreground "#cc6d00")))) `(org-level-3 ((,class (:height 1.1 :foreground "#cc6d00"))))
`(org-level-4 ((,class (:height 1.0 :weight bold :foreground "#2e994c")))) `(org-level-4 ((,class (:height 1.0 :foreground "#2e994c"))))
`(org-level-5 ((,class (:height 1.0 :weight bold :foreground "#00638a")))) `(org-level-5 ((,class (:height 1.0 :foreground "#00638a"))))
`(org-level-6 ((,class (:height 1.0 :weight bold :foreground "#D0372D")))) `(org-level-6 ((,class (:height 1.0 :foreground "#D0372D"))))
`(org-level-7 ((,class (:height 1.0 :weight bold :foreground "#008080")))) `(org-level-7 ((,class (:height 1.0 :foreground "#008080"))))
`(org-level-8 ((,class (:height 1.0 :weight bold :foreground "#6c7378")))) `(org-level-8 ((,class (:height 1.0 :foreground "#6c7378"))))
`(org-link ((,class ,petrol-link)))
`(org-block ((,class (:background "#f2f2f2")))) `(org-block ((,class (:background "#f2f2f2"))))
`(org-block-background ((,class (:background "#f2f2f2")))) `(org-block-background ((,class (:background "#f2f2f2"))))
`(org-block-begin-line ((,class (:underline nil :foreground "#454545" :background "#cfd8dc")))) `(org-block-begin-line ((,class (:underline nil :foreground "#454545" :background "#cfd8dc"))))
`(org-block-end-line ((,class (:overline nil :foreground "#454545" :background "#cfd8dc")))) `(org-block-end-line ((,class (:overline nil :foreground "#454545" :background "#cfd8dc"))))
`(org-checkbox ((,class (:weight bold :foreground "#7d57c2" :background "#f2f2f2")))) `(org-checkbox ((,class (:weight bold :foreground ,petrol-purple :background "#f2f2f2"))))
`(org-code ((,class (:foreground "#006400" :background "#fdfff7")))) `(org-code ((,class (:foreground "#006400" :background "#fdfff7"))))
`(org-table ((,class (:foreground "dark green" :background "#EAFFEA" :inherit fixed-pitch))))
`(org-todo ((,class (:weight bold :box (:line-width 1 :color "#993d3d") :foreground "#993d3d" :background "#ffdddd")))) `(org-todo ((,class (:weight bold :box (:line-width 1 :color "#993d3d") :foreground "#993d3d" :background "#ffdddd"))))
`(org-done ((,class (:weight bold :box (:line-width 1 :color "#2e994c") :foreground "#2e994c" :background "#ddffdd")))) `(org-done ((,class (:weight bold :box (:line-width 1 :color "#2e994c") :foreground "#2e994c" :background "#ddffdd"))))
`(org-headline-done ((,class (:height 1.0 :weight normal :strike-through t :foreground "#454545")))) `(org-headline-done ((,class (:height 1.0 :weight normal :foreground "#454545"))))
`(org-date ((,class (:foreground "#7d57c2")))) `(org-date ((,class (:foreground ,petrol-purple))))
`(org-document-title ((,class (:height 1.8 :weight bold :foreground "#454545")))) `(org-document-title ((,class (:height 1.8 :weight bold :foreground "#454545"))))
`(org-verbatim ((,class (:foreground "#0066CC" :background "#F7FDFF"))))
`(highlight-numbers-number ((,class (:foreground "#d75f00")))) `(highlight-numbers-number ((,class (:foreground "#d75f00"))))
@@ -319,12 +373,12 @@
`(js2-warning ((,class (:underline "#cc6d00")))) `(js2-warning ((,class (:underline "#cc6d00"))))
`(js2-external-variable ((,class (:foreground "#d0372d")))) `(js2-external-variable ((,class (:foreground "#d0372d"))))
`(js2-function-param ((,class (:foreground "#008abd")))) `(js2-function-param ((,class (:foreground "#008abd"))))
`(js2-instance-member ((,class (:foreground "#2f7e9d")))) `(js2-instance-member ((,class (:foreground ,petrol-blue))))
`(js2-jsdoc-html-tag-delimiter ((,class (:foreground "#d0372d")))) `(js2-jsdoc-html-tag-delimiter ((,class (:foreground "#d0372d"))))
`(js2-jsdoc-html-tag-name ((,class (:foreground "#d0372d")))) `(js2-jsdoc-html-tag-name ((,class (:foreground "#d0372d"))))
`(js2-jsdoc-tag ((,class (:weight normal :foreground "#7d57c2")))) `(js2-jsdoc-tag ((,class (:weight normal :foreground ,petrol-purple))))
`(js2-jsdoc-type ((,class (:foreground "#008abd")))) `(js2-jsdoc-type ((,class (:foreground "#008abd"))))
`(js2-jsdoc-value ((,class (:weight normal :foreground "#7d57c2")))) `(js2-jsdoc-value ((,class (:weight normal :foreground ,petrol-purple))))
`(js2-magic-paren ((,class (:underline t)))) `(js2-magic-paren ((,class (:underline t))))
`(js2-private-function-call ((,class (:foreground "#f38e00")))) `(js2-private-function-call ((,class (:foreground "#f38e00"))))
`(js2-private-member ((,class (:foreground "#008abd")))) `(js2-private-member ((,class (:foreground "#008abd"))))
@@ -348,12 +402,12 @@
`(magit-header-line ((,class (:foreground "#f2f2f2")))) `(magit-header-line ((,class (:foreground "#f2f2f2"))))
`(magit-hash ((,class (:foreground "#008080")))) `(magit-hash ((,class (:foreground "#008080"))))
`(magit-blame-hash ((,class (:foreground "#008080")))) `(magit-blame-hash ((,class (:foreground "#008080"))))
`(magit-blame-name ((,class (:foreground "#008abd" :weight bold)))) `(magit-blame-name ((,class (:foreground "#008abd"))))
`(magit-blame-date ((,class (:foreground "#cc6d00")))) `(magit-blame-date ((,class (:foreground "#cc6d00"))))
`(magit-blame-summary ((,class (:foreground "#678f03" :slant italic)))) `(magit-blame-summary ((,class (:foreground "#678f03" :slant italic))))
`(magit-blame-heading ((,class (:background "#e6e6e6")))) `(magit-blame-heading ((,class (:background "#e6e6e6"))))
`(magit-log-graph ((,class (:foreground "#7d57c2")))) `(magit-log-graph ((,class (:foreground ,petrol-purple))))
`(magit-log-author ((,class (:foreground "#008abd" :weight bold)))) `(magit-log-author ((,class (:foreground "#008abd"))))
`(magit-log-date ((,class (:foreground "#cc6d00")))) `(magit-log-date ((,class (:foreground "#cc6d00"))))
@@ -364,398 +418,27 @@
`(cypher-pattern-face ((,class (:foreground "#d70087" :background "#f2f2f2")))) `(cypher-pattern-face ((,class (:foreground "#d70087" :background "#f2f2f2"))))
`(cypher-relation-type-face ((,class (:weight normal :foreground "#008080")))) `(cypher-relation-type-face ((,class (:weight normal :foreground "#008080"))))
`(cypher-symbol-face ((,class (:slant italic :foreground "#454545")))) `(cypher-symbol-face ((,class (:slant italic :foreground "#454545"))))
`(cypher-variable-face ((,class (:foreground "#454545")))))) `(cypher-variable-face ((,class (:foreground "#454545"))))
;; lifted from leuven for now
;; `(w3m-anchor ((,class ,petrol-link)))
;; Petrol mode line `(w3m-arrived-anchor ((,class (:foreground "purple1"))))
`(w3m-bitmap-image-face ((,class (:foreground "gray4" :background "green"))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; `(w3m-bold ((,class (:weight bold :foreground "black"))))
;; `(w3m-current-anchor ((,class (:weight bold :foreground "blue"))))
;; Utils `(w3m-form ((,class (:underline t :foreground "tan1"))))
`(w3m-form-button-face ((,class (:weight bold :underline t :foreground "gray4" :background "light grey"))))
(defvar petrolline-selected-window (frame-selected-window) "Selected window.") `(w3m-form-button-mouse-face ((,class (:underline t :foreground "light grey" :background "#2B7E2A"))))
`(w3m-form-button-pressed-face ((,class (:weight bold :underline t :foreground "gray4" :background "light grey"))))
(defun petrolline-selected-window-active-p () `(w3m-header-line-location-content-face ((,class (:foreground "#7F7F7F":background "#F7F7F7"))))
"Return t if selected window is active." `(w3m-header-line-location-title-face ((,class (:foreground "#2C55B1" :background "#F7F7F7"))))
(eq petrolline-selected-window (selected-window))) `(w3m-history-current-url-face ((,class (:foreground "lemon chiffon"))))
`(w3m-image-face ((,class (:weight bold :foreground "DarkSeaGreen2"))))
(defun petrolline-set-selected-window () `(w3m-link-numbering ((,class (:foreground "#B4C7EB")))) ; mouseless browsing
"Set the variable for current selected window." `(w3m-strike-through-face ((,class (:strike-through t))))
(when (not (minibuffer-window-active-p (frame-selected-window))) `(w3m-underline-face ((,class (:underline t))))
(setq petrolline-selected-window (frame-selected-window)) )
(force-mode-line-update))) )
(defun petrolline-unset-selected-window ()
"Unset the variable for current selected window."
(setq petrolline-selected-window nil)
(force-mode-line-update))
(add-hook 'window-configuration-change-hook 'petrolline-set-selected-window)
(add-hook 'buffer-list-update-hook 'petrolline-set-selected-window)
(with-no-warnings
(add-hook 'focus-in-hook 'petrolline-set-selected-window)
(add-hook 'focus-out-hook 'petrolline-unset-selected-window))
;; Handle mode line alignment
(defun petrolline--format (left right)
"Return a string of `window-width' length with aligned `LEFT' and `RIGHT' segments."
(let ((right-length (length right)))
(when (and (display-graphic-p) (eq 'right (get-scroll-bar-mode)))
(setq right-length (- right-length 3)))
(concat left
" "
(propertize " "
'display
`((space :align-to (- (+ right right-fringe right-margin) ,(+ right-length 0)))))
right)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Faces
(defface petrolline-evil-normal-active
'((t :foreground "#388e3c"
:weight bold
:height 1.0))
"Face for evil normal state active.")
(defface petrolline-evil-normal-inactive
'((t :foreground "#a7cf42"
:weight bold
:height 1.0))
"Face for evil normal state inactive.")
(defface petrolline-evil-insert-active
'((t :foreground "#d0372d"
:weight bold
:height 1.0))
"Face for evil insert state active.")
(defface petrolline-evil-insert-inactive
'((t :foreground "#ff9999"
:weight bold
:height 1.0))
"Face for evil insert state inactive.")
(defface petrolline-evil-visual-active
'((t :foreground "#008abc"
:weight bold
:height 1.0))
"Face for evil visual state active.")
(defface petrolline-evil-visual-inactive
'((t :foreground "#8dd0eb"
:weight bold
:height 1.0))
"Face for evil visual state inactive.")
(defface petrolline-evil-replace-active
'((t :foreground "#c06600"
:weight bold
:height 1.0))
"Face for evil replace state active.")
(defface petrolline-evil-replace-inactive
'((t :foreground "#f0d97a"
:weight bold
:height 1.0))
"Face for evil replace state inactive.")
(defface petrolline-evil-emacs-active
'((t :foreground "#6c4ca8"
:weight bold
:height 1.0))
"Face for evil emacs state active.")
(defface petrolline-evil-emacs-inactive
'((t :foreground "#b48cff"
:weight bold
:height 1.0))
"Face for evil emacs state inactive.")
(defface petrolline-file-name-active
'((t :foreground "#00638a"
:weight bold))
"Face for buffer file name active.")
(defface petrolline-file-name-inactive
'((t :foreground "#8dd0eb"
:weight bold))
"Face for buffer file name inactive.")
(defface petrolline-major-mode-active
'((t :foreground "#6c4ca8"
:weight bold
:height 1.0))
"Face for major mode name active.")
(defface petrolline-major-mode-inactive
'((t :foreground "#b48cff"
:weight bold
:height 1.0))
"Face for major mode name inactive.")
(defface petrolline-vc-active
'((t :foreground "#5e8203"
:weight normal
:slant italic))
"Face for VC state active.")
(defface petrolline-vc-inactive
'((t :foreground "#a7cf42"
:weight normal
:slant italic))
"Face for VC state inactive.")
(defface petrolline-file-size-active
'((t :foreground "#cc6d00"
:weight normal))
"Face for file size active buffer.")
(defface petrolline-file-size-inactive
'((t :foreground "#f0d97a"
:weight normal))
"Face for file size inactive buffer.")
(defface petrolline-readonly
'((t :weight normal))
"Face for rean only buffer indication."
:group 'petrolline)
(defface petrolline-modified
'((t :weight normal))
"Face for modified buffer indication."
:group 'petrolline)
(defface petrolline-position-active
'((t :foreground "#cc6d00"
:weight normal))
"Face for position in active buffer.")
(defface petrolline-position-inactive
'((t :foreground "#f0d97a"
:weight normal))
"Face for position in inactive buffer.")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Segments
(defmacro defpetrolline (name body)
"Create a function with `NAME' and `BODY'."
`(defun ,name (&optional face)
(let ((str (format-mode-line ,body)))
(if face
(propertize str 'face face)
str))))
(defvar evil-state)
(declare-function evil-normal-state-p "evil")
(declare-function evil-insert-state-p "evil")
(declare-function evil-motion-state-p "evil")
(declare-function evil-visual-state-p "evil")
(declare-function evil-operator-state-p "evil")
(declare-function evil-replace-state-p "evil")
(declare-function evil-emacs-state-p "evil")
(declare-function evil-state-property "evil")
(defpetrolline petrolline--evil
(when (bound-and-true-p evil-local-mode)
(let ((active (petrolline-selected-window-active-p))
(tag (evil-state-property evil-state :tag t)))
(propertize tag
'face
(if active
(cond ((evil-normal-state-p) 'petrolline-evil-normal-active)
((evil-insert-state-p) 'petrolline-evil-insert-active)
((evil-motion-state-p) 'petrolline-evil-normal-active)
((evil-visual-state-p) 'petrolline-evil-visual-active)
((evil-operator-state-p) 'petrolline-evil-normal-active)
((evil-replace-state-p) 'petrolline-evil-replace-active)
((evil-emacs-state-p) 'petrolline-evil-emacs-active))
'petrolline-evil-emacs-inactive)))))
;; File name segment
(defpetrolline petrolline--file-name
(propertize "%b"
'help-echo (buffer-file-name)
'face
(if (petrolline-selected-window-active-p)
'petrolline-file-name-active
'petrolline-file-name-inactive)))
;; Major mode segment
(defpetrolline petrolline--major-mode
(propertize "%m"
'help-echo "Major mode name"
'face
(if (petrolline-selected-window-active-p)
'petrolline-major-mode-active
'petrolline-major-mode-inactive)))
;; Version Control segment
(defpetrolline petrolline--vc
(when (and vc-mode buffer-file-name)
(list
(propertize (format-mode-line '(vc-mode vc-mode))
'face
(if (petrolline-selected-window-active-p)
'petrolline-vc-active
'petrolline-vc-inactive)))))
;; File size segment
(defpetrolline petrolline--file-size
(propertize "%I"
'help-echo "file size"
'face
(if (petrolline-selected-window-active-p)
'petrolline-file-size-active
'petrolline-file-size-inactive)))
;; Readonly segment
(defpetrolline petrolline--readonly
(let ((tag (if (and
buffer-read-only
(not (string-match-p "\\*.*\\*" (buffer-name))))
(char-to-string ?r)
"")))
(propertize tag
'help-echo "read only"
'face
'petrolline-readonly)))
;; Modified segment
(defpetrolline petrolline--modified
(let ((tag (if (and (buffer-modified-p (current-buffer))
(not (string-match-p "\\*.*\\*" (buffer-name))))
(char-to-string ?*)
"")))
(propertize tag 'face 'petrolline-modified)))
;; Position segment
(defpetrolline petrolline--position
(let ((f (if (petrolline-selected-window-active-p)
'petrolline-position-active
'petrolline-position-inactive)))
(list
(propertize "%l" 'face f)
":"
(propertize "%c" 'face f))))
;; End of line segment
(defpetrolline petrolline--eol
(pcase (coding-system-eol-type buffer-file-coding-system)
(0 "LF")
(1 "CRLF")
(2 "CR")))
;; Encoding segment
(defpetrolline petrolline--encoding
(let ((sys (coding-system-plist buffer-file-coding-system)))
(cond ((memq (plist-get sys :category) '(coding-category-undecided coding-category-utf-8))
"utf-8")
(t (symbol-name (plist-get sys :name))))))
;; Flycheck segment
(declare-function flycheck-count-errors "flycheck" (errors))
(defvar flycheck-current-errors)
(defvar-local petrolline--flycheck-state nil)
(defun petrolline--flycheck-segment (&optional status)
"Display flycheck `STATUS'."
(setq petrolline--flycheck-state
(pcase status
('finished (if flycheck-current-errors
(let-alist (flycheck-count-errors flycheck-current-errors)
(let* ((errors (or .error 0))
(warnings (or .warning 0)))
(concat
(propertize "" 'help-echo "warnings" 'face 'warning)
" "
(number-to-string warnings)
" "
(propertize "" 'help-echo "errors" 'face 'error)
" "
(number-to-string errors)
)))
(propertize "" 'help-echo "good" 'face 'success)))
('running "⟲ checking")
('no-checker "? no checker")
('errored "! error")
('interrupted "! paused"))))
(defpetrolline petrolline--flycheck
petrolline--flycheck-state)
(defvar petrolline-default-mode-line-format mode-line-format
"Default format for mode line.")
(defun petrolline-default ()
"Rollback to default mode line."
(interactive)
(setq-default mode-line-format petrolline-default-mode-line-format))
;;;###autoload
(defun petrol-theme-mode-line ()
"Customize mode line to petrol style."
(interactive)
;; Setup flycheck hooks
(add-hook 'flycheck-status-changed-functions #'petrolline--flycheck-segment)
(add-hook 'flycheck-mode-hook #'petrolline--flycheck-segment)
(let ((class '((class color) (min-colors 89))))
(custom-set-faces
`(mode-line
((,class (:background "#f2f2f2"
:height 120
:foreground "#6c7b8b"
:box (:line-width 1 :color "#f2f2f2")))))
`(mode-line-inactive
((,class (:background "#f2f2f2"
:height 120
:foreground "#a8b3ba"
:box (:line-width 1 :color "#f2f2f2")))))))
(setq-default mode-line-format
'((:eval
(petrolline--format
;; left
(format-mode-line
'((:eval (petrolline--evil))
" "
(:eval (petrolline--file-name))
(:eval (petrolline--readonly))
(:eval (petrolline--modified))
" "
(:eval (petrolline--vc))
" "
(:eval (petrolline--flycheck))
" "
))
(format-mode-line
'(" "
(:eval (petrolline--position))
" "
(:eval (petrolline--encoding))
" "
(:eval (petrolline--eol))
" "
(:eval (petrolline--major-mode))
" ")))))))
;;;###autoload ;;;###autoload
(and load-file-name (and load-file-name