Skip to content

Syntax highlighting

Gonzalo Larumbe edited this page Sep 14, 2023 · 3 revisions

vhdl-ext provides many faces that inherit from existing ones in Emacs 29. This is done in order to avoid having default faces that might not be suitable for different themes.

The default values for these faces can be customized with very little configuration.

Configuration

First make sure that font-lock has been included in vhdl-ext-feature-list before running vhdl-ext-mode-setup.

There are two methods to configure faces:

  • Via M-x customize-group RET vhdl-ext-font-lock.

    • Customize faces and save configuration once you get the desired result
  • Through elisp code

    • Below there is a snippet with a configuration example that works well with a dark background:
    (set-face-attribute 'vhdl-ext-font-lock-then-face nil :foreground "dark olive green")
    (set-face-attribute 'vhdl-ext-font-lock-punctuation-face nil :foreground "burlywood")
    (set-face-attribute 'vhdl-ext-font-lock-operator-face nil :inherit 'vhdl-ext-font-lock-punctuation-face :weight 'extra-bold)
    (set-face-attribute 'vhdl-ext-font-lock-brackets-face nil :foreground "goldenrod")
    (set-face-attribute 'vhdl-ext-font-lock-parenthesis-face nil :foreground "dark goldenrod")
    (set-face-attribute 'vhdl-ext-font-lock-curly-braces-face nil :foreground "DarkGoldenrod2")
    (set-face-attribute 'vhdl-ext-font-lock-brackets-content-face nil :foreground "yellow green")
    (set-face-attribute 'vhdl-ext-font-lock-port-connection-face nil :foreground "bisque2")
    (set-face-attribute 'vhdl-ext-font-lock-entity-face nil :foreground "green1")
    (set-face-attribute 'vhdl-ext-font-lock-instance-face nil :foreground "medium spring green")
    (set-face-attribute 'vhdl-ext-font-lock-instance-lib-face nil :foreground "gray70")
    (set-face-attribute 'vhdl-ext-font-lock-translate-off-face nil :background "gray20" :slant 'italic)

vhdl-ts-mode

Syntax highlighting of vhdl-ts-mode is independent of the vhdl-ext font lock configuration.

To set it up there are also two methods:

  • Via M-x customize-group RET vhdl-ts-faces.

    • Customize faces and save configuration once you get the desired result
  • Through elisp code

    • Below there is a snippet with a configuration example that works well with a dark background:
    (set-face-attribute 'vhdl-ts-font-lock-then-face nil :foreground "dark olive green")
    (set-face-attribute 'vhdl-ts-font-lock-punctuation-face nil :foreground "burlywood")
    (set-face-attribute 'vhdl-ts-font-lock-operator-face nil :inherit 'vhdl-ts-font-lock-punctuation-face :weight 'extra-bold)
    (set-face-attribute 'vhdl-ts-font-lock-parenthesis-face nil :foreground "dark goldenrod")
    (set-face-attribute 'vhdl-ts-font-lock-brackets-content-face nil :foreground "yellow green")
    (set-face-attribute 'vhdl-ts-font-lock-port-connection-face nil :foreground "bisque2")
    (set-face-attribute 'vhdl-ts-font-lock-entity-face nil :foreground "green1")
    (set-face-attribute 'vhdl-ts-font-lock-instance-face nil :foreground "medium spring green")
    (set-face-attribute 'vhdl-ts-font-lock-instance-lib-face nil :foreground "gray70")
    (set-face-attribute 'vhdl-ts-font-lock-translate-off-face nil :background "gray20" :slant 'italic)
Clone this wiki locally