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

Update theme to hilight whole lines #13

Open
ybart opened this issue Aug 9, 2017 · 4 comments
Open

Update theme to hilight whole lines #13

ybart opened this issue Aug 9, 2017 · 4 comments

Comments

@ybart
Copy link

ybart commented Aug 9, 2017

I thought it would be great to hilight the whole diffed lines, so I ended using the following stylesheet:

atom-text-editor::shadow {
  .line {
    position: relative;

    .meta.diff.header::after, .meta.diff.index::after,
    .markup.inserted.diff::after, .markup.deleted.diff::after {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      display: block;
      z-index: -100;
      content: '';
    }

    .meta.diff.header::after, .meta.diff.index::after {
      background-color: #113050;
    }

    .markup.inserted.diff::after {
      background-color: #224422;
    }

    .markup.deleted.diff::after {
      background-color: #442222;
    }

    .markup.inserted.diff {
      color: #ccffcc;
    }

    .markup.deleted.diff {
      color: #ddaaaa;
    }
  }
}

It renders well with my theme (solarized-dark), but colors might need to be changed to use theme colors.

Here is a preview:

capture d ecran 2017-08-09 a 11 05 22

I got the CSS from here : https://discuss.atom.io/t/highlight-entire-line-depending-on-syntax/20653

@miketheman
Copy link
Owner

Hi @ybart ! This is a nice idea.

I've been using the built-in mechanisms for selecting colors for the diff text, based on variables that theme designers can then override. Example:

&.syntax--inserted {
color: @syntax-color-added;
}

I'm not certain that choosing definitive values is the right way to go here - are you aware of any specific theme color variables that are used across all Atom themes to highlight/invert?

@ybart
Copy link
Author

ybart commented Aug 11, 2017

I'm not aware of such variables names. However, ˋsyntax-backgoround-color-addedˋ might be a good fit.

We might also need to lighten and desature foreground colors as well to achieve a clean result.

Maybe we could also derivate these from syntax-background-color?

@miketheman
Copy link
Owner

Hi @ybart -
I spent a few hours trying to figure out the right way to do this.

An inherent problem is that I haven't figured out a way to "detect" if the user's theme is a dark or light one, and then shade/tint the colors accordingly. This may exist in LESS or Atom, I haven't found it yet.

The danger of using absolute values is that the behavior changes based on the user's theme, and I want to provide the best possible solution that doesn't look "bad" on a user's screen.

I had tried using contrast to change the background/foreground colors based on the syntax's background, but haven't been able to find the right mix of statements and logic.

I'll leave this issue open for now, but anyone looking to help out with this is welcome to.

@ybart
Copy link
Author

ybart commented Aug 13, 2017

Thanks you very much for your investigation. Unfortunately I don't have much time to investigate now. However I found this stack question interesting. However it will require some time to adjust and test with most common themes.

https://stackoverflow.com/questions/21600825/conditional-css-based-on-background-color-variable

A faster option would be to propose 2 or 3 variants and let the user choose in settings.

@ybart ybart changed the title Update theme to hi light whole lines Update theme to hilight whole lines Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants