Skip to content

Commit

Permalink
Implement region highlight style customization
Browse files Browse the repository at this point in the history
> Description

Added a theme customization to allow users to set a style for the region
highlighting either to "snowstorm" or "frost", providing a way for users
to adjust the colors to fit their needs.

The default is left to "nord2" as background- and no specific foreground
color.

The customization is available through the "nord-region-highlight"
variable of type "string".

> Usage

Example using the "snowstorm" style:
  (setq nord-region-highlight "snowstorm")

Resolves #32

GH-45
  • Loading branch information
arcticicestudio committed Sep 30, 2017
1 parent 24deba8 commit b43a249
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 2 deletions.
20 changes: 20 additions & 0 deletions README.md
Expand Up @@ -20,6 +20,8 @@ Nord Emacs is a 16 colorspace theme build to run in GUI- and terminal mode with
- [Package.el](#package-el)
- [Activation](#activation)
- [Features](#features)
- [Customization](#customization)
- [Region Highlight Style](#region-highlight-style)
- [Package Support](#package-support)
- [Syntax Packages](#syntax-packages)
- [UI Packages](#ui-packages)
Expand Down Expand Up @@ -71,6 +73,24 @@ or change it on-the-fly by running <kbd>M-x</kbd> `load-theme` <kbd>RET</kbd> `n

<p align="center"><strong>Colors of selected code can still be easily recognized.</strong><br><img src="https://raw.githubusercontent.com/arcticicestudio/nord-emacs/develop/assets/scrcast-feature-selection.gif"/></p>

## Customization

All customizations need to be set before `load-theme` is invoked for Nord and require a restart of Emacs when changed!

### Region Highlight Style

Allows to set a style for the region highlight based on the Nord components, either to `snowstorm` or `frost`.

To adhere to the Nord style guide this option uses `nord2` as background- and no specific foreground color.

It can be enabled by setting the `nord-region-highlight` variable to the desired style `snowstorm` or `frost` in your `init.el`:

```lisp
(setq nord-region-highlight "snowstorm")
```

<align="center"><strong><code>snowstorm</code> region highlight style</strong><br><img src="https://raw.githubusercontent.com/arcticicestudio/nord-emacs/develop/assets/scrot-customization-region-highlight-style-snowstorm.png"/><br><img src="https://raw.githubusercontent.com/arcticicestudio/nord-emacs/develop/assets/scrcast-customization-region-highlight-style-snowstorm.gif"/><br><strong><code>frost</code> region highlight style</strong><br><img src="https://raw.githubusercontent.com/arcticicestudio/nord-emacs/develop/assets/scrot-customization-region-highlight-style-frost.png"/><br><img src="https://raw.githubusercontent.com/arcticicestudio/nord-emacs/develop/assets/scrcast-customization-region-highlight-style-frost.gif"/><br><strong>default region highlight style</strong><br><img src="https://raw.githubusercontent.com/arcticicestudio/nord-emacs/develop/assets/scrot-customization-region-highlight-style-default.png"/><br><img src="https://raw.githubusercontent.com/arcticicestudio/nord-emacs/develop/assets/scrcast-customization-region-highlight-style-default.gif"/></p>

## Package Support
Nord Emacs provides support for many third-party syntax- and the UI packages.
Detailed descriptions for supported packages can be found in the [project wiki](https://github.com/arcticicestudio/nord-emacs/wiki).
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 21 additions & 2 deletions nord-theme.el
Expand Up @@ -42,6 +42,19 @@

(deftheme nord "An arctic, north-bluish clean and elegant theme")

(defgroup nord nil
"Nord theme customizations.
The theme has to be reloaded after changing anything in this group."
:group 'faces)

(defcustom nord-region-highlight nil
"Allows to set a region highlight style based on the Nord components.
Valid styles are
- 'snowstorm' - Uses 'nord0' as foreground- and 'nord4' as background color
- 'frost' - Uses 'nord0' as foreground- and 'nord8' as background color"
:type 'string
:group 'nord)

;;;; Color Constants
(let ((class '((class color) (min-colors 89)))
(nord0 (if (display-graphic-p) "#2E3440" nil))
Expand Down Expand Up @@ -74,7 +87,13 @@
(nord-regexp (if (display-graphic-p) "#EBCB8B" "yellow"))
(nord-string (if (display-graphic-p) "#A3BE8C" "green"))
(nord-tag (if (display-graphic-p) "#81A1C1" "blue"))
(nord-variable (if (display-graphic-p) "#D8DEE9" "#D8DEE9")))
(nord-variable (if (display-graphic-p) "#D8DEE9" "#D8DEE9"))
(nord-region-highlight-foreground (if (or
(string= nord-region-highlight "frost")
(string= nord-region-highlight "snowstorm")) "#2E3440" nil))
(nord-region-highlight-background (if
(string= nord-region-highlight "frost") "#88C0D0"
(if (string= nord-region-highlight "snowstorm") "#D8DEE9" "#434C5E"))))

;;;; +------------+
;;;; + Core Faces +
Expand Down Expand Up @@ -210,7 +229,7 @@
`(package-status-installed ((,class (:foreground ,nord7 :weight bold))))
`(package-status-unsigned ((,class (:underline ,nord13))))
`(query-replace ((,class (:foreground ,nord8 :background ,nord2))))
`(region ((,class (:background ,nord2))))
`(region ((,class (:foreground ,nord-region-highlight-foreground :background ,nord-region-highlight-background))))
`(scroll-bar ((,class (:background ,nord3))))
`(secondary-selection ((,class (:background ,nord2))))
`(show-paren-match-face ((,class (:foreground ,nord0 :background ,nord8))))
Expand Down

0 comments on commit b43a249

Please sign in to comment.