Add a section to tweak the look by shadowing face definitions
This commit is contained in:
parent
0c3b21eb85
commit
23a7b713df
97
README.org
97
README.org
@ -257,6 +257,88 @@ the ~custom-file~ as [[info:emacs#Saving Customizations][saving customizations (
|
||||
(add-to-list 'initial-frame-alist '(width . 180)))
|
||||
#+end_src
|
||||
|
||||
** [[info:emacs#Faces][Text faces or look (info)]]
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: sec:text-faces-or-look
|
||||
:END:
|
||||
|
||||
Section [[#sec:text-faces-or-styles][text faces or styles (info)]] tells that this setup does not use theming.
|
||||
However, it relies on shadowing the definition of faces in order to improve
|
||||
visibility. The last item in the page on [[https://orgmode.org/worg/org-contrib/babel/examples/fontify-src-code-blocks.html#org5c4406f][fontifying source code blocks]]
|
||||
describes this method. Section [[#sec:text-faces-or-styles][text faces or styles (info)]] also defines the
|
||||
function src_emacs-lisp{(my-invert-default-face)} to toggle between a dark and a
|
||||
light background.
|
||||
|
||||
#+caption[Improve the visibility of faces in =faces.el=]:
|
||||
#+caption: Improve the visibility of faces in =faces.el=.
|
||||
#+name: lst:tweak-faces-faces-early
|
||||
#+begin_src emacs-lisp
|
||||
;; Shadow the definition in faces.el:
|
||||
(defface region
|
||||
'((((class color) (min-colors 88) (background dark))
|
||||
:background "blue3" :extend t)
|
||||
(((class color) (min-colors 88) (background light) (type gtk))
|
||||
:distant-foreground "gtk_selection_fg_color"
|
||||
:background "LightGoldenrod2" :extend t)
|
||||
(((class color) (min-colors 88) (background light) (type ns))
|
||||
:distant-foreground "ns_selection_fg_color"
|
||||
:background "ns_selection_bg_color" :extend t)
|
||||
(((class color) (min-colors 88) (background light))
|
||||
:background "LightGoldenrod2" :extend t)
|
||||
(((class color) (min-colors 16) (background dark))
|
||||
:background "blue3" :extend t)
|
||||
(((class color) (min-colors 16) (background light))
|
||||
:background "LightGoldenrod2" :extend t)
|
||||
(((class color) (min-colors 8))
|
||||
:background "blue" :foreground "white" :extend t)
|
||||
(((type tty) (class mono))
|
||||
:inverse-video t)
|
||||
(t :background "gray" :extend t))
|
||||
"My basic face for highlighting the region.")
|
||||
#+end_src
|
||||
|
||||
#+caption[Improve the visibility of faces in =org-faces.el=]:
|
||||
#+caption: Improve the visibility of faces in =org-faces.el=.
|
||||
#+name: lst:tweak-org-faces-early
|
||||
#+begin_src emacs-lisp
|
||||
;; Shadow the definition in org-faces.el:
|
||||
(defface org-block
|
||||
;; https://emacs.stackexchange.com/questions/9600/
|
||||
;; how-can-i-override-a-pre-defined-face-for-light-and-dark-backgrounds
|
||||
`((((background dark))
|
||||
:inherit (fixed-pitch)
|
||||
,@(and (>= emacs-major-version 27) '(:extend t))
|
||||
:background "#444444")
|
||||
(t
|
||||
:inherit (fixed-pitch)
|
||||
,@(and (>= emacs-major-version 27) '(:extend t))
|
||||
:background "#FFFFD0"))
|
||||
"My face used for text inside various blocks.
|
||||
|
||||
It is always used for source blocks. You can refine what face
|
||||
should be used depending on the source block language by setting,
|
||||
`org-src-block-faces', which takes precedence.
|
||||
|
||||
When `org-fontify-quote-and-verse-blocks' is not nil, text inside
|
||||
verse and quote blocks are fontified using the `org-verse' and
|
||||
`org-quote' faces, which inherit from `org-block'.")
|
||||
#+end_src
|
||||
|
||||
#+caption[Improve the visibility of faces in =sh-script.el=]:
|
||||
#+caption: Improve the visibility of faces in =sh-script.el=.
|
||||
#+name: lst:tweak-sh-script-faces-early
|
||||
#+begin_src emacs-lisp
|
||||
;; Shadow the definition in sh-script.el:
|
||||
(defface sh-heredoc
|
||||
'((((class color) (background dark))
|
||||
(:foreground "yellow"))
|
||||
(((class color) (background light))
|
||||
(:foreground "magenta"))
|
||||
(t
|
||||
(:weight bold)))
|
||||
"My face to show a here-document.")
|
||||
#+end_src
|
||||
|
||||
* [[info:emacs#Package Installation][Install the selected packages (info)]]
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: sec:install-selected-packages
|
||||
@ -2515,7 +2597,7 @@ on tables by means of =org-narrow-to-table=.
|
||||
(define-key ctl-x-map (kbd "n t") #'org-narrow-to-table)
|
||||
(define-key ctl-x-map (kbd "C-n") #'narrow-or-widen-dwim)
|
||||
#+end_src
|
||||
** [[info:emacs#Faces][Text faces (or styles)]]
|
||||
** [[info:emacs#Faces][Text faces or styles (info)]]
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: sec:text-faces-or-styles
|
||||
:END:
|
||||
@ -2532,8 +2614,7 @@ The code in listing [[lst:configure-face-attributes]] source implements those ru
|
||||
In case of proper initialization of all face heigths, font scaling is easy as
|
||||
listing [[lst:my-set-default-face-height]] shows. Finally, the code in listing
|
||||
[[lst:my-invert-default-face]] allows swapping the foreground and background colors
|
||||
of the default face on all frames and the code in listing [[lst:custom-set-faces]]
|
||||
improves the visibility of some default faces.
|
||||
of the default face on all frames.
|
||||
|
||||
#+caption[Configure =face-attributse=]:
|
||||
#+caption: Configure =face-attributes=.
|
||||
@ -2587,16 +2668,6 @@ improves the visibility of some default faces.
|
||||
(invert-face 'default)))
|
||||
#+end_src
|
||||
|
||||
#+caption[Improve the visibility of some default faces]:
|
||||
#+caption: Improve the visibility of some default faces.
|
||||
#+name: lst:custom-set-faces
|
||||
#+begin_src emacs-lisp
|
||||
(with-eval-after-load 'faces
|
||||
(custom-set-faces
|
||||
'(region ((((class color) (min-colors 88) (background light) (type gtk))
|
||||
:background "lightgoldenrod2")))))
|
||||
#+end_src
|
||||
|
||||
** [[https://jblevins.org/log/rainbow-mode][Visualize color codes and names]]
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: sec:rainbow-mode
|
||||
|
Loading…
Reference in New Issue
Block a user