diff --git a/README.md b/README.md index b4da5de..dc3ac92 100644 --- a/README.md +++ b/README.md @@ -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) + - [Custom Comment Brightness](#custom-comment-brightness) - [Package Support](#package-support) - [Syntax Packages](#syntax-packages) - [UI Packages](#ui-packages) @@ -71,6 +73,50 @@ or change it on-the-fly by running M-x `load-theme` RET `n

Colors of selected code can still be easily recognized.

+## Customization + +All customizations need to be set before `load-theme` is invoked for Nord and require a restart of Emacs when changed! + +### Custom Comment Brightness + +This customization allows to define a custom comment color brightness with percentage adjustments from *0* - *20*. It is a way to provide a way for users to easily adjust the comment color to fit their needs without overriding specific faces individually. + +It can be enabled by adding the `nord-comment-brightness` variable to a number between `1` and `20` in your `init.el`: + +```lisp +(setq nord-comment-brightness 15) +``` + +To adhere to the Nord style guide this option uses `nord3` by default and applied as fallback when the variable is assigned a invalid value. + +This customization is a port of the reference implementation from the [Nord Atom Syntax][nord-atom-syntax-gh-47] project. The values are calculated using the LESSCSS [`lighten`][lesscss-doc-lighten] function to ensure full interoperability with other port projects that providing this theme feature. + +| Increased by | Calculated value | +| --- | --- | +| 0% (default) | `nord3` | +| 1% | `#4e586d` | +| 2% | `#505b70` | +| 3% | `#525d73` | +| 4% | `#556076` | +| 5% | `#576279` | +| 6% | `#59647c` | +| 7% | `#5b677f` | +| 8% | `#5d6982` | +| 9% | `#5f6c85` | +| 10% | `#616e88` | +| 11% | `#63718b` | +| 12% | `#66738e` | +| 13% | `#687591` | +| 14% | `#6a7894` | +| 15% | `#6d7a96` | +| 16% | `#6f7d98` | +| 17% | `#72809a` | +| 18% | `#75829c` | +| 19% | `#78859e` | +| 20% | `#7b88a1` | + +Default comment brightness


Increased comment brightness by 15%

+ ## 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). @@ -118,3 +164,6 @@ Please report issues/bugs, feature requests and suggestions for improvements to

Copyright © 2017 Arctic Ice Studio

+ +[lesscss-doc-lighten]: http://lesscss.org/functions/#color-operations-lighten +[nord-atom-syntax-gh-47]: https://github.com/arcticicestudio/nord-atom-syntax/issues/47 diff --git a/assets/scrot-custom-comment-brightness-java-15percent.png b/assets/scrot-custom-comment-brightness-java-15percent.png new file mode 100755 index 0000000..63c5266 Binary files /dev/null and b/assets/scrot-custom-comment-brightness-java-15percent.png differ diff --git a/assets/scrot-custom-comment-brightness-java-default.png b/assets/scrot-custom-comment-brightness-java-default.png new file mode 100755 index 0000000..d577b2a Binary files /dev/null and b/assets/scrot-custom-comment-brightness-java-default.png differ diff --git a/assets/scrot-custom-comment-brightness-js-15percent.png b/assets/scrot-custom-comment-brightness-js-15percent.png new file mode 100755 index 0000000..e65312d Binary files /dev/null and b/assets/scrot-custom-comment-brightness-js-15percent.png differ diff --git a/assets/scrot-custom-comment-brightness-js-default.png b/assets/scrot-custom-comment-brightness-js-default.png new file mode 100755 index 0000000..6bd17fa Binary files /dev/null and b/assets/scrot-custom-comment-brightness-js-default.png differ diff --git a/nord-theme.el b/nord-theme.el index 8231a31..cb8300d 100644 --- a/nord-theme.el +++ b/nord-theme.el @@ -42,6 +42,28 @@ (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-comment-brightness 0 + "Allows to define a custom comment color brightness with percentage adjustments from 0% - 20%. + The value must be greater or equal to 0 and less or equal to 20, otherwise the default 'nord3' color is used." + :type 'integer + :group 'nord) + +(setq nord-brightened-comments '("#4c566a" "#4e586d" "#505b70" "#525d73" "#556076" "#576279" "#59647c" "#5b677f" "#5d6982" "#5f6c85" "#616e88" "#63718b" "#66738e" "#687591" "#6a7894" "#6d7a96" "#6f7d98" "#72809a" "#75829c" "#78859e" "#7b88a1")) + +(defun brightened-comment-color (percent) + "Returns the brightened comment color for the given percent. + The value must be greater or equal to 0 and less or equal to 20, otherwise the default 'nord3' color is used." + (if (and (integerp percent) + (>= percent 0) + (<= percent 20)) + (nth percent nord-brightened-comments) + (nth 0 nord-brightened-comments))) + ;;;; Color Constants (let ((class '((class color) (min-colors 89))) (nord0 (if (display-graphic-p) "#2E3440" nil)) @@ -63,7 +85,7 @@ (nord-annotation (if (display-graphic-p) "#D08770" "brightyellow")) (nord-attribute (if (display-graphic-p) "#8FBCBB" "cyan")) (nord-class (if (display-graphic-p) "#8FBCBB" "cyan")) - (nord-comment (if (display-graphic-p) "#4C566A" "brightblack")) + (nord-comment (if (display-graphic-p) (brightened-comment-color nord-comment-brightness) "brightblack")) (nord-escape (if (display-graphic-p) "#D08770" "brightyellow")) (nord-method (if (display-graphic-p) "#88C0D0" "brightcyan")) (nord-keyword (if (display-graphic-p) "#81A1C1" "blue")) @@ -88,10 +110,10 @@ `(error ((,class (:foreground ,nord11 :weight bold)))) `(escape-glyph ((,class (:foreground ,nord12)))) `(font-lock-builtin-face ((,class (:foreground ,nord9)))) - `(font-lock-comment-face ((,class (:foreground ,nord3)))) - `(font-lock-comment-delimiter-face ((,class (:foreground ,nord3)))) + `(font-lock-comment-face ((,class (:foreground ,nord-comment)))) + `(font-lock-comment-delimiter-face ((,class (:foreground ,nord-comment)))) `(font-lock-constant-face ((,class (:foreground ,nord9)))) - `(font-lock-doc-face ((,class (:foreground ,nord3)))) + `(font-lock-doc-face ((,class (:foreground ,nord-comment)))) `(font-lock-function-name-face ((,class (:foreground ,nord8)))) `(font-lock-keyword-face ((,class (:foreground ,nord9)))) `(font-lock-negation-char-face ((,class (:foreground ,nord9)))) @@ -142,7 +164,7 @@ `(custom-button-pressed-unraised ((,class (:background ,nord4 :foreground ,nord0 :box (:line-width 2 :color ,nord4 :style sunken-button))))) `(custom-button-unraised ((,class (:background ,nord0 :foreground ,nord8 :box (:line-width 2 :color ,nord4 :style sunken-button))))) `(custom-changed ((,class (:foreground ,nord13)))) - `(custom-comment ((,class (:foreground ,nord3)))) + `(custom-comment ((,class (:foreground ,nord-comment)))) `(custom-comment-tag ((,class (:foreground ,nord7)))) `(custom-documentation ((,class (:foreground ,nord4)))) `(custom-group-tag ((,class (:foreground ,nord8 :weight bold)))) @@ -323,7 +345,7 @@ `(js2-jsdoc-html-tag-name ((,class (:foreground ,nord9)))) `(js2-external-variable ((,class (:foreground ,nord4)))) `(js2-function-param ((,class (:foreground ,nord4)))) - `(js2-jsdoc-value ((,class (:foreground ,nord3)))) + `(js2-jsdoc-value ((,class (:foreground ,nord-comment)))) `(js2-jsdoc-tag ((,class (:foreground ,nord7)))) `(js2-jsdoc-type ((,class (:foreground ,nord7)))) `(js2-private-member ((,class (:foreground ,nord4)))) @@ -348,7 +370,7 @@ `(js3-warning-face ((,class (:foreground ,nord13)))) ;; > Markdown - `(markdown-blockquote-face ((,class (:foreground ,nord3)))) + `(markdown-blockquote-face ((,class (:foreground ,nord-comment)))) `(markdown-bold-face ((,class (:inherit bold)))) `(markdown-header-face-1 ((,class (:foreground ,nord8)))) `(markdown-header-face-2 ((,class (:foreground ,nord8))))