-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
diff-so-fancy [1] provided a way better highlighting than diff-highlight [2], the tool that is shipped with Git. Anyway, next to the fact that it is written in Perl and required yet another interpreter installation, there have also been long-time problems regarding the `fatal: mismatched output` error when running as `interactive.diffFilter`. In so-fancy/diff-so-fancy#296 and so-fancy/diff-so-fancy#35 are long discussions and some proposed workarounds, but none really worked properly. Therefore I switched to delta [3] a while ago and the configurations have now been tested enough on a day-by-day basis to be persisted in igloo. delta not only provides the same features like diff-so-fancy and other highlighters [4] but comes with many more advantages. The highlighting can also be styled using the same themes like bat [5] that is also already available as snowblock [6]. The colors have been adjusted to match the Nord [7] theme. Note that the Nord color palettes must be provided through the terminal [8] as the 16 ANSI base colors. Some diff specific colors have been specified as HEX tripplets. The background colors for added, removed and modified lines are adjusted in brightness and saturation using the `scale()` function [9] of the `color` module [10] provided by the official Sass reference implementation written in Dart [11]. ```scss @use "sass:color"; $nord10: #5e81ac; $nord11: #bf616a; $minus-color: color.scale($nord11, $lightness: -28%, $saturation: -20%); $plus-color: color.scale($nord10, $lightness: -22%, $saturation: -16%); ``` [1]: https://github.com/so-fancy/diff-so-fancy [2]: https://github.com/git/git/tree/master/contrib/diff-highlight [3]: https://github.com/dandavison/delta [4]: https://github.com/dandavison/delta#features [5]: https://github.com/sharkdp/bat [6]: https://github.com/arcticicestudio/igloo/tree/master/snowblocks/bat [7]: https://www.nordtheme.com [8]: https://www.nordtheme.com/ports [9]: https://sass-lang.com/documentation/modules/color#scale [10]: https://sass-lang.com/documentation/modules [11]: https://github.com/sass/dart-sass GH-281 Co-authored-by: Sven Greb <[email protected]>
- Loading branch information
1 parent
ca31290
commit d42b158
Showing
4 changed files
with
41 additions
and
28 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Colors | ||
|
||
## _diff_ Syntax Highlighter | ||
|
||
Instead of using the [diff-highlight][] tool that is bundled with _Git_ [diff-so-fancy][] was used for some time because it provided way better syntax highlighting features and styles. | ||
Anyway, next to the fact that it is written in _Perl_ and required yet another interpreter installation, there have also been long-time problems regarding the `fatal: mismatched output` error when running as `interactive.diffFilter`. In https://github.com/so-fancy/diff-so-fancy/issues/296 and https://github.com/so-fancy/diff-so-fancy/issues/35 are long discussions and some proposed workarounds, but none really worked properly. | ||
|
||
Anyway, next to the fact that it is written in _Perl_ and therefore requires yet another interpreter installation there have also been long-time problems regarding the `fatal: mismatched output` error when running as Git‘s `interactive.diffFilter`. There are long discussions and some workarounds in https://github.com/so-fancy/diff-so-fancy/issues/296 and https://github.com/so-fancy/diff-so-fancy/issues/35, but none really worked 100% even when additional new lines at the end have been removed from target files. | ||
|
||
Therefore this configuration switched to [delta][] that not only provides the [same features like _diff-so-fancy_ and other highlighters][delta#features] but also comes with many more advantages. | ||
The highlighting can also be styled using the same themes like [bat][], that is also already [available as _snowblock_][gh-tree-sb-bat], and so the colors have been adjusted to match the [Nord][] theme. | ||
Note that the _Nord_ color palettes must be [provided through the terminal][nord-ports] as the 16 ANSI base colors. Some _diff_ specific colors are specified as HEX tripplets. The background colors for added, removed and modified lines have been adjusted in brightness and saturation using the [`scale()` function][sass-docs-mods-color#scale] of the [`color` module][sass-docs-mods] provided by the [official Sass reference implementation written in Dart][sass]. | ||
|
||
```scss | ||
@use "sass:color"; | ||
|
||
$nord10: #5e81ac; | ||
$nord11: #bf616a; | ||
|
||
$minus-color: color.scale($nord11, $lightness: -28%, $saturation: -20%); | ||
$plus-color: color.scale($nord10, $lightness: -22%, $saturation: -16%); | ||
``` | ||
|
||
[bat]: https://github.com/sharkdp/bat | ||
[delta]: https://github.com/dandavison/delta | ||
[delta#features]: https://github.com/dandavison/delta#features | ||
[diff-highlight]: https://github.com/git/git/tree/master/contrib/diff-highlight | ||
[diff-so-fancy]: https://github.com/so-fancy/diff-so-fancy | ||
[gh-tree-sb-bat]: https://github.com/arcticicestudio/igloo/tree/master/snowblocks/bat | ||
[nord-ports]: https://www.nordtheme.com/ports | ||
[nord]: https://www.nordtheme.com | ||
[sass-docs-mods-color#scale]: https://sass-lang.com/documentation/modules/color#scale | ||
[sass-docs-mods]: https://sass-lang.com/documentation/modules | ||
[sass]: https://github.com/sass/dart-sass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters