Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from diff-so-fancy to delta #281

Closed
arcticicestudio opened this issue May 9, 2020 · 0 comments · Fixed by #282
Closed

Switch from diff-so-fancy to delta #281

arcticicestudio opened this issue May 9, 2020 · 0 comments · Fixed by #282

Comments

@arcticicestudio
Copy link
Owner

arcticicestudio commented May 9, 2020

diff-so-fancy provided a way better highlighting than diff-highlight, the tool that is shipped with Git.
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 so-fancy/diff-so-fancy#296 and so-fancy/diff-so-fancy#35, but none really worked 100% even when additional new lines at the end have been removed from target files.

Therefore I switched to delta 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 but comes with many more advantages. The highlighting can also be styled using the same themes like bat that is also already available as snowblock.

The colors will be adjusted to match the Nord theme.
Note that the Nord color palettes must be provided through the terminal as the 16 ANSI base colors. Some diff specific colors will be specified as HEX triplets. The background colors for added, removed and modified lines will be adjusted in brightness and saturation using the scale() function of the color module provided by the official Sass reference implementation written in Dart.

@arcticicestudio arcticicestudio added this to the Next milestone May 9, 2020
arcticicestudio added a commit that referenced this issue May 9, 2020
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]>
arcticicestudio added a commit that referenced this issue May 9, 2020
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 triplets. 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

Closes GH-281

Co-authored-by: Sven Greb <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants