rebelot / kanagawa.nvim

NeoVim dark colorscheme inspired by the colors of the famous painting by Katsushika Hokusai.
MIT License
4.09k stars 173 forks source link

Wrong link to delta theme #213

Open WhyNotHugo opened 6 months ago

WhyNotHugo commented 6 months ago

The README refers to the tmTheme for delta:

https://github.com/rebelot/kanagawa.nvim/blob/bfa818c7bf6259152f1d89cf9fbfba3554c93695/README.md?plain=1#L371

It's an XML file:

https://github.com/rebelot/kanagawa.nvim/blob/bfa818c7bf6259152f1d89cf9fbfba3554c93695/extras/kanagawa.tmTheme#L1-L450

But themes for delta are not XML or anything similar at all:

https://github.com/dandavison/delta/blob/main/themes.gitconfig

ta5een commented 6 months ago

Hi, I recently came across this issue and I believe I found a solution.

According to the documentation, delta is able to read .tmTheme files if you use bat to build the theme for you. If you have bat installed, try following these steps:

  1. Clone the Kanagawa theme into bat's theme config folder. On macOS, this would be ~/.config/bat/themes (refer to the "Adding new themes" section in the README).
$ mkdir -p "$(bat --config-dir)/themes"
$ cd "$(bat --config-dir)/themes"
$ git clone https://github.com/obergodmar/kanagawa-tmTheme.git kanagawa
  1. Next, tell bat to update the binary cache with the new theme:
$ bat cache --build
  1. To verify that the Kanagawa theme is installed for bat, run the following:
$ bat --list-themes
... omitted lines ...

Theme: Kanagawa

  // Output the square of a number.
  fn print_square(num: f64) {
      let result = f64::powf(num, 2.0);
      println!("The square of {:.2} is {:.2}.", num, result);
  }

... omitted lines ...
  1. Now, delta should be able to pick up this theme. You can verify this by running the following:
$ delta --show-syntax-themes
... omitted lines ...
Syntax theme: Kanagawa

example.rs
──────────

───┐
1: │
───┘
// Output the square of a number.
fn print_square(num: f64) {
    let result = f64::powf(num, 2.0);
    println!("The square of {:.2} is {:.2}.", num, result);
// Output the cube of a number.
fn print_cube(num: f64) {
    let result = f64::powf(num, 3.0);
    println!("The cube of {:.2} is {:.2}.", num, result);

... omitted lines ...
  1. To apply this theme, edit your ~/.gitconfig or ~/.config/git/config file with the following changes:
 [delta]
         navigate = true
+        syntax-theme = Kanagawa
  1. delta should now have this theme applied the next time you run it.

Hope this helps 🙂

s-e-f commented 1 month ago

delta distinguishes between "syntax themes" and "themes" (or styles). While syntax themes can be read from bat, styles can not. Syntax themes only apply to the foreground color (the actual syntax) while the style can apply diff-related styling such as added/removed.

It would be great if there was a delta style that matches the syntax theme (on my current machine the default style has bad contrast with the kanagawa syntax theme).